1414 IMAGE_NAME : ${{ github.repository }}
1515
1616jobs :
17- build-and-push-docmost :
18- runs-on : ubuntu-latest
17+ build :
18+ strategy :
19+ matrix :
20+ include :
21+ - platform : linux/amd64
22+ runner : ubuntu-latest
23+ suffix : amd64
24+ - platform : linux/arm64
25+ runner : ubuntu-24.04-arm
26+ suffix : arm64
27+ runs-on : ${{ matrix.runner }}
1928 permissions :
2029 contents : read
2130 packages : write
@@ -31,13 +40,64 @@ jobs:
3140 username : ${{ github.actor }}
3241 password : ${{ secrets.GITHUB_TOKEN }}
3342
34- - name : Set up QEMU
35- uses : docker/setup-qemu-action@v4
43+ - name : Set up Docker Buildx
44+ uses : docker/setup-buildx-action@v4
45+
46+ - name : Extract metadata
47+ id : meta
48+ uses : docker/metadata-action@v6
49+ with :
50+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
51+
52+ - name : Build and push by digest
53+ id : build
54+ uses : docker/build-push-action@v7
55+ with :
56+ context : .
57+ platforms : ${{ matrix.platform }}
58+ labels : ${{ steps.meta.outputs.labels }}
59+ outputs : type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
60+ cache-from : type=gha,scope=${{ matrix.suffix }}
61+ cache-to : type=gha,scope=${{ matrix.suffix }},mode=max
62+
63+ - name : Export digest
64+ run : |
65+ mkdir -p /tmp/digests
66+ digest="${{ steps.build.outputs.digest }}"
67+ touch "/tmp/digests/${digest#sha256:}"
68+
69+ - name : Upload digest
70+ uses : actions/upload-artifact@v4
71+ with :
72+ name : digest-${{ matrix.suffix }}
73+ path : /tmp/digests/*
74+ if-no-files-found : error
75+ retention-days : 1
76+
77+ merge :
78+ runs-on : ubuntu-latest
79+ needs : build
80+ permissions :
81+ packages : write
82+ steps :
83+ - name : Download digests
84+ uses : actions/download-artifact@v4
85+ with :
86+ path : /tmp/digests
87+ pattern : digest-*
88+ merge-multiple : true
3689
3790 - name : Set up Docker Buildx
3891 uses : docker/setup-buildx-action@v4
3992
40- - name : Extract metadata for Docmost
93+ - name : Log in to the Container registry
94+ uses : docker/login-action@v4
95+ with :
96+ registry : ${{ env.REGISTRY }}
97+ username : ${{ github.actor }}
98+ password : ${{ secrets.GITHUB_TOKEN }}
99+
100+ - name : Extract metadata
41101 id : meta
42102 uses : docker/metadata-action@v6
43103 with :
@@ -48,13 +108,12 @@ jobs:
48108 type=semver,pattern={{version}}
49109 type=semver,pattern={{major}}.{{minor}}
50110
51- - name : Build and push Docmost image
52- uses : docker/build-push-action@v7
53- with :
54- context : .
55- push : true
56- tags : ${{ steps.meta.outputs.tags }}
57- labels : ${{ steps.meta.outputs.labels }}
58- platforms : linux/amd64,linux/arm64
59- cache-from : type=gha
60- cache-to : type=gha,mode=max
111+ - name : Create manifest list and push
112+ working-directory : /tmp/digests
113+ run : |
114+ docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
115+ $(printf '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)
116+
117+ - name : Inspect image
118+ run : |
119+ docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
0 commit comments