Skip to content

Add CUDA architecture configuration with GPU compute capability #195

Add CUDA architecture configuration with GPU compute capability

Add CUDA architecture configuration with GPU compute capability #195

Workflow file for this run

name: Docker Image CI
on:
push:
branches: ["main"]
# tags: ["v*"] # Uncomment to trigger on version tags
pull_request:
branches: ["main"]
jobs:
build:
strategy:
matrix:
include:
- runner: ubuntu-latest
platform: linux/amd64
tag-suffix: amd64
- runner: ubuntu-24.04-arm
platform: linux/arm64
tag-suffix: arm64
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate image tags
id: tags
run: |
# Use the current repository name
IMAGE_NAME="ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')"
echo "image-name=${IMAGE_NAME}" >> $GITHUB_OUTPUT
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "suffix=pr-${{ github.event.pull_request.number }}-${{ matrix.tag-suffix }}" >> $GITHUB_OUTPUT
echo "manifest-tag=pr-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
else
echo "suffix=${{ matrix.tag-suffix }}" >> $GITHUB_OUTPUT
echo "manifest-tag=latest" >> $GITHUB_OUTPUT
fi
- name: Build and push Docker image
if: ${{github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push'}}
id: push
uses: docker/build-push-action@v5
with:
context: .
platforms: ${{ matrix.platform }}
push: true
tags: ${{ steps.tags.outputs.image-name }}:${{ steps.tags.outputs.suffix }}
create-manifest:
if: ${{github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push'}}
needs: build
runs-on: ubuntu-latest
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Determine tags
id: tags
run: |
# Use the current repository name
IMAGE_NAME="ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')"
echo "image-name=${IMAGE_NAME}" >> $GITHUB_OUTPUT
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "manifest-tag=pr-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
echo "amd64-tag=pr-${{ github.event.pull_request.number }}-amd64" >> $GITHUB_OUTPUT
echo "arm64-tag=pr-${{ github.event.pull_request.number }}-arm64" >> $GITHUB_OUTPUT
else
echo "manifest-tag=latest" >> $GITHUB_OUTPUT
echo "amd64-tag=amd64" >> $GITHUB_OUTPUT
echo "arm64-tag=arm64" >> $GITHUB_OUTPUT
fi
- name: Create and push multi-arch manifest
run: |
docker buildx imagetools create -t ${{ steps.tags.outputs.image-name }}:${{ steps.tags.outputs.manifest-tag }} \
${{ steps.tags.outputs.image-name }}:${{ steps.tags.outputs.amd64-tag }} \
${{ steps.tags.outputs.image-name }}:${{ steps.tags.outputs.arm64-tag }}