15
15
# Use docker.io for Docker Hub if empty
16
16
REGISTRY : docker.io
17
17
# github.repository as <account>/<repo>
18
- IMAGE_NAME : nanobits /python-cuda
18
+ IMAGE_NAME : ${{ secrets.DOCKERHUB_USERNAME }} /python-cuda
19
19
20
20
21
21
jobs :
22
22
build :
23
23
runs-on : ubuntu-latest
24
+ strategy :
25
+ matrix :
26
+ python : [3.9]
27
+ cuda : [11.8.0]
28
+ cudnn : [8]
29
+ ubuntu : [22.04]
24
30
permissions :
25
31
contents : read
26
32
packages : write
@@ -57,11 +63,11 @@ jobs:
57
63
58
64
# Extract metadata (tags, labels) for Docker
59
65
# https://github.com/docker/metadata-action
60
- # - name: Extract Docker metadata
61
- # id: meta
62
- # uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
63
- # with:
64
- # images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
66
+ - name : Extract Docker metadata
67
+ id : meta
68
+ uses : docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
69
+ with :
70
+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
65
71
66
72
# Build and push Docker image with Buildx (don't push on PR)
67
73
# https://github.com/docker/build-push-action
@@ -71,10 +77,15 @@ jobs:
71
77
with :
72
78
context : .
73
79
push : ${{ github.event_name != 'pull_request' }}
74
- tags : latest # ${{ steps.meta.outputs.tags }}
80
+ tags : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:py${{ matrix.python }}-cuda${{ matrix.cuda }}-cudnn${{ matrix.cudnn }}-ubuntu${{ matrix.ubuntu }} # ${{ steps.meta.outputs.tags }}
75
81
labels : ${{ steps.meta.outputs.labels }}
76
82
cache-from : type=gha
77
83
cache-to : type=gha,mode=max
84
+ build-args : |
85
+ PYTHON_VERSION=${{ matrix.python }}
86
+ CUDA_VERSION=${{ matrix.cuda }}
87
+ CUDNN_VERSION=${{ matrix.cudnn }}
88
+ UBUNTU_VERSION=${{ matrix.ubuntu }}
78
89
79
90
80
91
# Sign the resulting Docker image digest except on PRs.
88
99
COSIGN_EXPERIMENTAL : " true"
89
100
# This step uses the identity token to provision an ephemeral certificate
90
101
# against the sigstore community Fulcio instance.
91
- run : echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }}
102
+ run : echo "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:py${{ matrix.python }}-cuda${{ matrix.cuda }}-cudnn${{ matrix.cudnn }}-ubuntu${{ matrix.ubuntu }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }}
0 commit comments