|
1 | | - |
2 | 1 | name: Build Docker Image on Tag (CUDA 12) |
3 | 2 |
|
4 | 3 | on: |
|
10 | 9 | REGISTRY: docker.io |
11 | 10 |
|
12 | 11 | jobs: |
13 | | - |
14 | 12 | build: |
15 | | - |
16 | 13 | runs-on: ubuntu-latest |
17 | | - |
18 | 14 | steps: |
19 | | - - name: Checkout repository |
20 | | - uses: actions/checkout@v3 |
21 | | - |
22 | | - - name: Log in to the Container registry |
23 | | - uses: docker/login-action@v2 |
24 | | - with: |
25 | | - registry: docker.io |
26 | | - username: ${{ secrets.DOCKER_USER }} |
27 | | - password: ${{ secrets.DOCKER_PASSWORD }} |
28 | | - |
29 | | - - name: Extract metadata (tags, labels) for Docker |
30 | | - id: meta |
31 | | - uses: docker/metadata-action@v4 |
32 | | - with: |
33 | | - images: ${{ env.REGISTRY }}/${{ secrets.DOCKER_REPO }} |
34 | | - |
35 | | - - name: Build the docker image |
36 | | - run: docker build . --file Dockerfile --tag gdl-cuda12:${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} --build-arg GIT_TAG=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} |
37 | | - |
38 | | - - name: Tag the docker image |
39 | | - run: docker tag gdl-cuda12:${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} ${{ secrets.DOCKER_REPO }}/gdl-cuda12:${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} |
40 | | - |
41 | | - - name: Push the docker image |
42 | | - run: docker push ${{ secrets.DOCKER_REPO }}/gdl-cuda12:${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} |
43 | | - |
44 | | - - name: Tag the docker image to latest |
45 | | - run: docker tag gdl-cuda12:${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} ${{ secrets.DOCKER_REPO }}/gdl-cuda12:latest |
46 | | - |
47 | | - - name: Push the docker image (latest tag) |
48 | | - run: docker push ${{ secrets.DOCKER_REPO }}/gdl-cuda12:latest |
| 15 | + - name: Checkout repository |
| 16 | + uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Log in to Container registry |
| 19 | + uses: docker/login-action@v3 |
| 20 | + with: |
| 21 | + registry: docker.io |
| 22 | + username: ${{ secrets.DOCKER_USER }} |
| 23 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 24 | + |
| 25 | + - name: Extract metadata (tags, labels) for Docker |
| 26 | + id: meta |
| 27 | + uses: docker/metadata-action@v4 |
| 28 | + with: |
| 29 | + images: ${{ env.REGISTRY }}/${{ secrets.DOCKER_REPO }}/gdl-cuda12 |
| 30 | + tags: | |
| 31 | + type=ref,event=tag |
| 32 | + type=raw,value=latest,enable=true |
| 33 | +
|
| 34 | + - name: Build and push Docker image |
| 35 | + uses: docker/build-push-action@v6 |
| 36 | + with: |
| 37 | + context: . |
| 38 | + file: ./Dockerfile |
| 39 | + push: true |
| 40 | + tags: ${{ steps.meta.outputs.tags }} |
| 41 | + labels: ${{ steps.meta.outputs.labels }} |
0 commit comments