-
Notifications
You must be signed in to change notification settings - Fork 314
83 lines (73 loc) · 3 KB
/
build_cuda_all.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: deploy_cuda_docker
# gh workflow run deploy_cuda_docker
# This also runs on release deploy
on:
workflow_dispatch:
release:
types: [published]
push:
tags:
- '**[0-9]+.[0-9]+.[0-9]+*'
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/setup-buildx-action@v3
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@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta-cuda
uses: docker/metadata-action@v5
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@v6
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