Skip to content

Commit

Permalink
added repos and testing
Browse files Browse the repository at this point in the history
  • Loading branch information
yfukai committed Jan 29, 2024
1 parent 94807bb commit b8ed4d5
Show file tree
Hide file tree
Showing 4 changed files with 185 additions and 7 deletions.
59 changes: 54 additions & 5 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ on:
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
JAX_VERSION : 0.4.23
# github.repository as <account>/<repo>
JAX_CONDA_IMAGE_NAME : "yfukai/conda-jax"
IMAGE_NAME: ${{ github.repository }}


Expand All @@ -36,7 +38,7 @@ jobs:
# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
- name: Install Cosign
if: github.event_name != 'pull_request'
# if: github.event_name != 'pull_request'
uses: sigstore/[email protected]
with:
cosign-release: 'v2.2.1'
Expand All @@ -48,7 +50,7 @@ jobs:
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
# if: github.event_name != 'pull_request'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
Expand All @@ -57,12 +59,19 @@ jobs:

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata (JAX conda)
id: meta_jax_conda
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}


- name: Get the tag name
run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV

Expand All @@ -71,12 +80,52 @@ jobs:

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
- name: Build and push Docker image (JAX conda CPU)
id: build-and-push-jax-conda-cpu
uses: docker/build-push-action@v5
with:
context: jax_image/
platforms: linux/amd64,linux/arm64/v8
push: true #${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta_jax_conda.outputs.tags }}
labels: ${{ steps.meta_jax_conda.outputs.labels }}
build-args: |
JAX_VERSION=${{ env.JAX_version }}
- name: Build and push Docker image (JAX conda GPU)
id: build-and-push-jax-conda-gpu
uses: docker/build-push-action@v5
with:
context: jax_image/
platforms: linux/amd64
push: true #${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta_jax_conda.outputs.tags }}-cuda
labels: ${{ steps.meta_jax_conda.outputs.labels }}
build-args: |
JAX_VERSION=${{ env.JAX_version }}
JAX_VERSION_EXTRA="cuda11_local"
BASE_IMAGE="nvidia/cuda:11.8.0-cudnn8-devel-ubuntu20.04"
- name: Build and push Docker image (CPU)
id: build-and-push-cpu
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64/v8
push: ${{ github.event_name != 'pull_request' }}
push: true # ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BASE_IMAGE="${{ env.REGISTRY }}/${{ env.JAX_CONDA_IMAGE_NAME }}:latest"
- name: Build and push Docker image (GPU)
id: build-and-push-gpu
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
push: true #${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}-cuda
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BASE_IMAGE="${{ env.REGISTRY }}/${{ env.JAX_CONDA_IMAGE_NAME }}:latest-cuda"
128 changes: 128 additions & 0 deletions .github/workflows/jax-conda-docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: Docker

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

on:
release:
types: [ "published" ]
pull_request:
branches: [ "main" ]

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
JAX_VERSION : 0.4.23
# github.repository as <account>/<repo>
JAX_CONDA_IMAGE_NAME : "yfukai/conda-jax"
IMAGE_NAME: ${{ github.repository }}


jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

strategy:
matrix:
target: ["cpu", "gpu"]

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
- name: Install Cosign
if: github.event_name != 'pull_request'
uses: sigstore/[email protected]
with:
cosign-release: 'v2.2.1'

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Get the tag name
run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image (JAX conda CPU)
id: build-and-push-jax-conda-cpu
uses: docker/build-push-action@v5
with:
context: jax_image/
platforms: linux/amd64,linux/arm64/v8
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
JAX_VERSION=${{ env.JAX_version }}
- name: Build and push Docker image (JAX conda GPU)
id: build-and-push-jax-conda-gpu
uses: docker/build-push-action@v5
with:
context: jax_image/
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
JAX_VERSION=${{ env.JAX_version }}
JAX_VERSION_EXTRA="cuda11_local"
BASE_IMAGE="nvidia/cuda:11.8.0-cudnn8-devel-ubuntu20.04"
- name: Build and push Docker image (CPU)
id: build-and-push-cpu
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64/v8
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BASE_IMAGE="${{ env.REGISTRY }}/yfukai/conda-jax:latest"
- name: Build and push Docker image (GPU)
id: build-and-push-gpu
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BASE_IMAGE="${{ env.REGISTRY }}/yfukai/conda-jax:latest-cuda"
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG BASE_IMAGE="yfukai/conda-jax:latest"
ARG BASE_IMAGE="ghcr.io/yfukai/conda-jax:latest"

FROM ${BASE_IMAGE}
#https://stackoverflow.com/questions/44438637/arg-substitution-in-run-command-not-working-for-dockerfile
Expand Down
3 changes: 2 additions & 1 deletion jax_image/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ docker buildx build \
docker buildx build \
--push \
--platform linux/amd64 \
--build-arg BASE_IMAGE="nvidia/cuda:11.8.0-cudnn8-devel-ubuntu20.04" \
--build-arg JAX_VERSION="$JAX_VERSION" \
--build-arg JAX_VERSION_EXTRA="cuda12_pip" \
--build-arg JAX_VERSION_EXTRA="cuda11_local" \
-t yfukai/conda-jax:$JAX_VERSION-cuda \
-t yfukai/conda-jax:latest-cuda \
"."

0 comments on commit b8ed4d5

Please sign in to comment.