deploy_cuda_docker #25
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: deploy_cuda_docker | |
# gh workflow run deploy_cuda_docker | |
# This also runs on release deploy | |
on: | |
workflow_dispatch: | |
release: | |
types: [published] | |
tags: | |
- 'v*' | |
jobs: | |
build-and-push-image: | |
strategy: | |
matrix: | |
compute_capability: [75, 80, 86, 89, 90] | |
fail-fast: false | |
runs-on: [ubuntu-latest] | |
permissions: | |
contents: write | |
packages: write | |
# This is used to complete the identity challenge | |
# with sigstore/fulcio when running outside of PRs. | |
id-token: write | |
security-events: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Initialize Docker Buildx | |
uses: docker/[email protected] | |
with: | |
install: true | |
- name: Setup cache | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Inject slug/short variables | |
uses: rlespinasse/[email protected] | |
- name: Login to GitHub Container Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta-cuda | |
uses: docker/[email protected] | |
with: | |
images: | | |
ghcr.io/${{env.GITHUB_REPOSITORY_OWNER_PART}}/${{env.GITHUB_REPOSITORY_NAME_PART}} | |
flavor: | | |
latest=false | |
tags: | | |
type=semver,pattern=cuda-${{matrix.compute_capability}}-{{version}} | |
type=semver,pattern=cuda-${{matrix.compute_capability}}-{{major}}.{{minor}} | |
type=raw,value=cuda-${{matrix.compute_capability}}-latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} | |
type=raw,value=cuda-${{matrix.compute_capability}}-sha-${{ env.GITHUB_SHA_SHORT }} | |
- name: Build and push Docker image | |
id: build-and-push-cuda | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: Dockerfile.cuda-all | |
push: ${{ github.event_name != 'pull_request' }} | |
platforms: 'linux/amd64' | |
tags: ${{ steps.meta-cuda.outputs.tags }} | |
labels: ${{ steps.meta-cuda.outputs.labels }} | |
build-args: | | |
CUDA_COMPUTE_CAP=${{matrix.compute_capability}} | |
cache-from: type=local,src=/tmp/.buildx-cache | |