From 7fc5575ca6d4cfbbc1b33fa5847552e7f2313a34 Mon Sep 17 00:00:00 2001 From: Hilmar Lapp Date: Fri, 27 Sep 2024 20:45:12 -0400 Subject: [PATCH] Adds build for Keras2 / Tensorflow 2.15 Also fixes tf-probability req. --- .github/workflows/build-deploy-cuda.yml | 11 +- .github/workflows/build-deploy-keras2.yml | 124 ++++++++++++++++++++++ .github/workflows/build-deploy.yml | 11 +- requirements.tf-2.17.0.txt | 2 +- 4 files changed, 141 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/build-deploy-keras2.yml diff --git a/.github/workflows/build-deploy-cuda.yml b/.github/workflows/build-deploy-cuda.yml index c9ba6b0..3f9d30a 100644 --- a/.github/workflows/build-deploy-cuda.yml +++ b/.github/workflows/build-deploy-cuda.yml @@ -7,12 +7,15 @@ on: - 'LICENSE' - 'README.md' - .github/workflows/build-deploy.yml + - '.github/workflows/build-deploy-keras2.yml' + - 'requirements.tf-2.15.0.txt' release: types: [published] env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} + TF_VERSION: 2.17.0 jobs: build-and-push-pyimage: @@ -41,7 +44,7 @@ jobs: with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} flavor: | - suffix=-py-cuda,onlatest=true + suffix=-py-cuda-tf${{ env.TF_VERSION }},onlatest=true tags: | type=raw,value=latest,enable={{is_default_branch}} type=raw,value={{date 'YYYY'}},enable={{is_default_branch}} @@ -58,7 +61,7 @@ jobs: file: Dockerfile-pyonly build-args: | CUDA=cuda- - TENSORFLOW_VERSION=2.17.0 + TENSORFLOW_VERSION=${{ env.TF_VERSION }} push: true tags: ${{ steps.metagpu.outputs.tags }} labels: ${{ steps.metagpu.outputs.labels }} @@ -104,7 +107,7 @@ jobs: with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} flavor: | - suffix=-cuda,onlatest=true + suffix=-cuda-tf${{ env.TF_VERSION }},onlatest=true tags: | type=raw,value=latest,enable={{is_default_branch}} type=raw,value={{date 'YYYY'}},enable={{is_default_branch}} @@ -119,7 +122,7 @@ jobs: with: context: . build-args: | - BASE_TAG=latest-py-cuda + BASE_TAG=latest-py-cuda-tf${{ env.TF_VERSION }} push: true tags: ${{ steps.metagpu.outputs.tags }} labels: ${{ steps.metagpu.outputs.labels }} diff --git a/.github/workflows/build-deploy-keras2.yml b/.github/workflows/build-deploy-keras2.yml new file mode 100644 index 0000000..3370c6e --- /dev/null +++ b/.github/workflows/build-deploy-keras2.yml @@ -0,0 +1,124 @@ +name: Create and publish a Docker image + +on: + push: + branches: main + paths-ignore: + - 'LICENSE' + - 'README.md' + - '.github/workflows/build-deploy-cuda.yml' + - '.github/workflows/build-deploy.yml' + - 'requirements.tf-2.17.0.txt' + release: + types: [published] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + TF_VERSION: 2.15.0 + +jobs: + build-and-push-pyimage: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: linux/amd64,linux/arm64 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + flavor: | + suffix=-py-tf${{ env.TF_VERSION }},onlatest=true + tags: | + type=raw,value=latest,enable={{is_default_branch}} + type=raw,value={{date 'YYYY'}},enable={{is_default_branch}} + type=semver,pattern={{major}}.{{minor}}.{{patch}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + labels: | + org.opencontainers.image.description=Combines the Docker Stacks tensorflow-notebook and pytorch-notebook containers plus jupytext and custom package additions. + annotations: | + org.opencontainers.image.description=Combines the Docker Stacks tensorflow-notebook and pytorch-notebook containers plus jupytext and custom package additions. + + - name: Build and push Python-only Docker image + uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile-pyonly + build-args: | + TENSORFLOW_VERSION=${{ env.TF_VERSION }} + push: true + platforms: linux/amd64,linux/arm64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + annotations: ${{ steps.meta.outputs.annotations }} + cache-to: type=gha,mode=max + cache-from: type=gha + + build-and-push-image-withR: + runs-on: ubuntu-latest + needs: build-and-push-pyimage + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + flavor: | + suffix=-tf${{ env.TF_VERSION }},onlatest=true + tags: | + type=raw,value=latest,enable={{is_default_branch}} + type=raw,value={{date 'YYYY'}},enable={{is_default_branch}} + type=semver,pattern={{major}}.{{minor}}.{{patch}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + labels: | + org.opencontainers.image.description=Combines the Docker Stacks tensorflow-notebook, pytorch-notebook, and r-notebook containers plus jupytext and custom package additions. + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + build-args: | + BASE_TAG=latest-py-tf${{ env.TF_VERSION }} + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 1fdd7e4..8ab65d2 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -7,12 +7,15 @@ on: - 'LICENSE' - 'README.md' - '.github/workflows/build-deploy-cuda.yml' + - '.github/workflows/build-deploy-keras2.yml' + - 'requirements.tf-2.15.0.txt' release: types: [published] env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} + TF_VERSION: 2.17.0 jobs: build-and-push-pyimage: @@ -46,7 +49,7 @@ jobs: with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} flavor: | - suffix=-py,onlatest=true + suffix=-py-tf${{ env.TF_VERSION }},onlatest=true tags: | type=raw,value=latest,enable={{is_default_branch}} type=raw,value={{date 'YYYY'}},enable={{is_default_branch}} @@ -64,7 +67,7 @@ jobs: context: . file: Dockerfile-pyonly build-args: | - TENSORFLOW_VERSION=2.17.0 + TENSORFLOW_VERSION=${{ env.TF_VERSION }} push: true platforms: linux/amd64,linux/arm64 tags: ${{ steps.meta.outputs.tags }} @@ -99,6 +102,8 @@ jobs: uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + flavor: | + suffix=-tf${{ env.TF_VERSION }},onlatest=true tags: | type=raw,value=latest,enable={{is_default_branch}} type=raw,value={{date 'YYYY'}},enable={{is_default_branch}} @@ -112,6 +117,8 @@ jobs: uses: docker/build-push-action@v6 with: context: . + build-args: | + BASE_TAG=latest-py-tf${{ env.TF_VERSION }} push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/requirements.tf-2.17.0.txt b/requirements.tf-2.17.0.txt index a0a1d74..5161f4b 100644 --- a/requirements.tf-2.17.0.txt +++ b/requirements.tf-2.17.0.txt @@ -1,4 +1,4 @@ -tensorflow-probability +tensorflow-probability[tf] tensorflow-text ; platform_machine != "aarch64" keras-nlp ; platform_machine != "aarch64" # As per its own req's, transformers needs TF<2.16, but apparently it