1- name : Docker Build
1+ name : Build and Publish Multi-Platform Docker Image
22
33on :
44 push :
55 branches : ["main"]
66 tags : ["*"]
77
88jobs :
9- build :
10- strategy :
11- matrix :
12- include :
13- - platform : linux/amd64
14- runs-on : ubuntu-latest
15- - platform : linux/arm64
16- runs-on : ubuntu-latest-arm64
17-
18- runs-on : ${{ matrix.runs-on }}
19- permissions :
20- contents : read
21- packages : write
22-
23- steps :
24- - name : Checkout repository
25- uses : actions/checkout@v4
26-
27- - name : Prepare repository name in lowercase
28- id : repo
29- run : echo "name=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
30- - name : Set up QEMU
31- uses : docker/setup-qemu-action@v3
9+ build-amd64 :
10+ uses : ./.github/workflows/publish-amd64.yml
11+ secrets : inherit
3212
33- - name : Set up Docker Buildx
34- uses : docker/setup-buildx-action@v3
35-
36- - name : Log in to the Container registry
37- uses : docker/login-action@v3
38- with :
39- registry : ghcr.io
40- username : ${{ github.actor }}
41- password : ${{ secrets.GITHUB_TOKEN }}
42-
43- - name : Extract metadata for platform-specific image
44- id : meta
45- uses : docker/metadata-action@v5
46- with :
47- images : ghcr.io/${{ steps.repo.outputs.name }}
48- tags : |
49- type=ref,event=branch
50- type=ref,event=tag
51- type=raw,value=latest,enable=true
52- flavor :
53- suffix=-{{platform_dash}}
54- latest=false
55-
56- - name : Build and push platform-specific image
57- uses : docker/build-push-action@v5
58- with :
59- context : .
60- platforms : ${{ matrix.platform }}
61- push : true
62- tags : ${{ steps.meta.outputs.tags }}
63- labels : ${{ steps.meta.outputs.labels }}
64- cache-from : type=gha
65- cache-to : type=gha,mode=max
13+ build-arm64 :
14+ uses : ./.github/workflows/publish-arm64.yml
15+ secrets : inherit
6616
6717 manifest :
68- needs : build
18+ needs : [ build-amd64, build-arm64]
6919 runs-on : ubuntu-latest
7020 permissions :
21+ contents : read
7122 packages : write
7223
7324 steps :
74- - name : Prepare repository name in lowercase
25+ - name : " Prepare repository name in lowercase"
7526 id : repo
7627 run : echo "name=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
7728
9748 for tag in ${{ steps.meta.outputs.tags }}; do
9849 echo "Creating manifest for ${tag}"
9950 docker buildx imagetools create --tag "${tag}" \
100- "${tag}-linux- amd64" \
101- "${tag}-linux- arm64"
51+ "${tag}-amd64" \
52+ "${tag}-arm64"
10253 done
0 commit comments