Skip to content

Commit

Permalink
Adds build for Keras2 / Tensorflow 2.15
Browse files Browse the repository at this point in the history
Also fixes tf-probability req.
  • Loading branch information
hlapp committed Sep 28, 2024
1 parent eac3689 commit 7fc5575
Show file tree
Hide file tree
Showing 4 changed files with 141 additions and 7 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/build-deploy-cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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}}
Expand All @@ -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 }}
Expand Down Expand Up @@ -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}}
Expand All @@ -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 }}
124 changes: 124 additions & 0 deletions .github/workflows/build-deploy-keras2.yml
Original file line number Diff line number Diff line change
@@ -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 }}
11 changes: 9 additions & 2 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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}}
Expand All @@ -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 }}
Expand Down Expand Up @@ -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}}
Expand All @@ -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 }}
2 changes: 1 addition & 1 deletion requirements.tf-2.17.0.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 7fc5575

Please sign in to comment.