Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
187 changes: 187 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
name: Build all

on:
push:

env:
CONTAINER_REGISTRY: ghcr.io

defaults:
run:
shell: bash

permissions:
contents: read
packages: write

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
create-cuda-build-and-run-images:
runs-on: ${{ matrix.PLATFORM == 'linux/arm64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
strategy:
fail-fast: true
matrix:
PLATFORM:
- linux/amd64
- linux/arm64
env:
CONTAINER_BUILD_IMAGE_NAME: ${{ github.repository }}/cuda-build-image
CONTAINER_RUN_IMAGE_NAME: ${{ github.repository }}/cuda-run-image
steps:
- name: Checkout repository
uses: actions/checkout@v5

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.CONTAINER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Docker run-image meta
id: run_meta
uses: docker/metadata-action@v5
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
with:
images: ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_RUN_IMAGE_NAME }}
annotations: |
org.opencontainers.image.title=renku-frontend-buildpacks/cuda-run-image
org.opencontainers.image.description=The run image for CUDA-enabled buildpacks
labels: |
io.buildpacks.base.distro.name=ubuntu
io.buildpacks.base.distro.version=24.04
org.opencontainers.image.title=renku-frontend-buildpacks/cuda-run-image
org.opencontainers.image.description=The run image for CUDA-enabled buildpacks
tags: |
type=sha,prefix=${{ matrix.PLATFORM == 'linux/arm64' && 'arm64' || 'amd64' }}-

- name: Build and push cuda run-image
uses: docker/build-push-action@v6
with:
context: ./run-image
file: ./run-image/Dockerfile
platforms: ${{ matrix.PLATFORM }}
build-args: base_image=nvcr.io/nvidia/cuda-dl-base:25.10-cuda13.0-devel-ubuntu24.04
target: run
push: true
tags: ${{ steps.run_meta.outputs.tags }}
labels: ${{ steps.run_meta.outputs.labels }}
annotations: ${{ steps.run_meta.outputs.annotations }}
cache-from: type=gha,scope=cuda-run-image-${{ matrix.PLATFORM == 'linux/arm64' && 'arm64' || 'amd64' }}
cache-to: type=gha,mode=max,scope=cuda-run-image-${{ matrix.PLATFORM == 'linux/arm64' && 'arm64' || 'amd64' }}

- name: Docker build-image meta
id: build_meta
uses: docker/metadata-action@v5
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
with:
images: ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_BUILD_IMAGE_NAME }}
annotations: |
org.opencontainers.image.title=renku-frontend-buildpacks/cuda-build-image
org.opencontainers.image.description=The build image for CUDA-enabled buildpacks
labels: |
io.buildpacks.base.distro.name=ubuntu
io.buildpacks.base.distro.version=24.04
org.opencontainers.image.title=renku-frontend-buildpacks/cuda-build-image
org.opencontainers.image.description=The build image for CUDA-enabled buildpacks
tags: |
type=sha,prefix=${{ matrix.PLATFORM == 'linux/arm64' && 'arm64' || 'amd64' }}-

- name: Build and push cuda build-image
uses: docker/build-push-action@v6
with:
context: ./run-image
file: ./run-image/Dockerfile
platforms: ${{ matrix.PLATFORM }}
build-args: base_image=nvcr.io/nvidia/cuda-dl-base:25.10-cuda13.0-devel-ubuntu24.04
target: build
push: true
tags: ${{ steps.build_meta.outputs.tags }}
labels: ${{ steps.build_meta.outputs.labels }}
annotations: ${{ steps.build_meta.outputs.annotations }}
cache-from: type=gha,scope=cuda-build-image-${{ matrix.PLATFORM == 'linux/arm64' && 'arm64' || 'amd64' }}
cache-to: type=gha,mode=max,scope=cuda-build-image-${{ matrix.PLATFORM == 'linux/arm64' && 'arm64' || 'amd64' }}

combine-cuda-build-and-run-images:
needs: [create-cuda-build-and-run-images]
runs-on: ubuntu-24.04
strategy:
fail-fast: true
matrix:
IMAGE_TYPE:
- build
- run
steps:
- name: Checkout repository
uses: actions/checkout@v5

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.CONTAINER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: index
with:
images: ${{ env.CONTAINER_REGISTRY }}/${{ github.repository }}/cuda-${{ matrix.IMAGE_TYPE }}-image
annotations: |
org.opencontainers.image.title=renku-frontend-buildpacks/cuda-${{ matrix.IMAGE_TYPE }}-image
org.opencontainers.image.description=The ${{ matrix.IMAGE_TYPE }} image for CUDA-enabled buildpacks
labels: |
io.buildpacks.base.distro.name=ubuntu
io.buildpacks.base.distro.version=24.04
org.opencontainers.image.title=renku-frontend-buildpacks/cuda-${{ matrix.IMAGE_TYPE }}-image
org.opencontainers.image.description=The ${{ matrix.IMAGE_TYPE }} image for CUDA-enabled buildpacks
tags: |
type=sha,prefix=
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=semver,pattern={{version}},event=tag

- name: Docker meta amd64
id: meta_amd64
uses: docker/metadata-action@v5
with:
images: ${{ env.CONTAINER_REGISTRY }}/${{ github.repository }}/cuda-${{ matrix.IMAGE_TYPE }}-image
tags: |
type=sha,prefix=amd64-

- name: Docker meta arm64
id: meta_arm64
uses: docker/metadata-action@v5
with:
images: ${{ env.CONTAINER_REGISTRY }}/${{ github.repository }}/cuda-${{ matrix.IMAGE_TYPE }}-image
tags: |
type=sha,prefix=arm64-

- name: Combine images
run: |
readarray -t TAG_ARGS<<<$(echo '${{ steps.meta.outputs.json }}' | jq -cr '.tags | map("--tag\n" + .) | join("\n")')
echo "TAG_ARGS=${TAG_ARGS[@]}"
readarray -t ANNOTATION_ARGS<<<$(echo '${{ steps.meta.outputs.json }}' | jq -cr '.annotations | map("--annotation\n" + .) | join("\n")')
echo "ANNOTATION_ARGS=${ANNOTATION_ARGS[@]}"
LINUX_AMD64_IMAGE=$(echo '${{ steps.meta_amd64.outputs.json }}' | jq -cr '.tags[0]')
echo "LINUX_AMD64_IMAGE=${LINUX_AMD64_IMAGE}"
LINUX_ARM64_IMAGE=$(echo '${{ steps.meta_arm64.outputs.json }}' | jq -cr '.tags[0]')
echo "LINUX_ARM64_IMAGE=${LINUX_ARM64_IMAGE}"
set -x
docker buildx imagetools create \
"${TAG_ARGS[@]}" \
"${ANNOTATION_ARGS[@]}" \
"${LINUX_AMD64_IMAGE}" \
"${LINUX_ARM64_IMAGE}"