44 push :
55 branches : [ "main" ]
66
7+ permissions :
8+ contents : read
9+
710jobs :
811 build :
9- runs-on : ${{ matrix.arch == 'amd64' && 'ubuntu-latest' || 'ubuntu-24.04-arm64' }}
12+ # Note: If ubuntu-24.04-arm64 hangs, verify your Org settings for "Larger Runners"
13+ runs-runs-on : ${{ matrix.arch == 'amd64' && 'ubuntu-latest' || 'ubuntu-24.04-arm64' }}
1014 strategy :
15+ fail-fast : false # Robustness: If one arch fails, don't kill the other immediately
1116 matrix :
1217 arch : [amd64, arm64]
1318
@@ -24,25 +29,35 @@ jobs:
2429 username : ${{ secrets.DOCKERHUB_USERNAME }}
2530 password : ${{ secrets.DOCKERHUB_API_KEY }}
2631
32+ - name : Extract metadata
33+ id : meta
34+ uses : docker/metadata-action@v5
35+ with :
36+ images : cdrl/3podr_container
37+
2738 - name : Build and push by digest
2839 id : build
2940 uses : docker/build-push-action@v6
3041 with :
3142 context : .
3243 platforms : linux/${{ matrix.arch }}
44+ labels : ${{ steps.meta.outputs.labels }}
45+ # Use gha cache for speed across parallel runs
46+ cache-from : type=gha
47+ cache-to : type=gha,mode=max
3348 outputs : type=image,name=cdrl/3podr_container,push-by-digest=true,name-canonical=true,push=true
3449
3550 - name : Export digest
3651 run : |
37- mkdir -p /tmp /digests
52+ mkdir -p ${{ runner.temp }} /digests
3853 digest="${{ steps.build.outputs.digest }}"
39- touch "/tmp /digests/${digest#sha256:}"
54+ touch "${{ runner.temp }} /digests/${digest#sha256:}"
4055
4156 - name : Upload digest
4257 uses : actions/upload-artifact@v4
4358 with :
4459 name : digests-${{ matrix.arch }}
45- path : /tmp /digests/*
60+ path : ${{ runner.temp }} /digests/*
4661 if-no-files-found : error
4762 retention-days : 1
4863
@@ -53,18 +68,35 @@ jobs:
5368 - name : Download digests
5469 uses : actions/download-artifact@v4
5570 with :
56- path : /tmp /digests
71+ path : ${{ runner.temp }} /digests
5772 pattern : digests-*
5873 merge-multiple : true
5974
75+ - name : Set up Docker Buildx
76+ uses : docker/setup-buildx-action@v3
77+
6078 - name : Login to Docker Hub
6179 uses : docker/login-action@v3
6280 with :
6381 username : ${{ secrets.DOCKERHUB_USERNAME }}
6482 password : ${{ secrets.DOCKERHUB_API_KEY }}
6583
84+ - name : Extract metadata (for final tags)
85+ id : meta
86+ uses : docker/metadata-action@v5
87+ with :
88+ images : cdrl/3podr_container
89+ tags : |
90+ type=ref,event=branch
91+ type=sha,format=short
92+ latest
93+
6694 - name : Create manifest list and push
67- working-directory : /tmp/digests
95+ working-directory : ${{ runner.temp }}/digests
96+ run : |
97+ docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
98+ $(printf 'cdrl/3podr_container@sha256:%s ' *)
99+
100+ - name : Inspect image
68101 run : |
69- docker buildx imagetools create -t cdrl/3podr_container:latest \
70- $(printf 'cdrl/3podr_container@sha256:%s ' *)
102+ docker buildx imagetools inspect cdrl/3podr_container:${{ steps.meta.outputs.version }}
0 commit comments