13
13
jobs :
14
14
build :
15
15
if : " !contains(github.event.head_commit.message, 'skip ci')"
16
- runs-on : ubuntu-22 .04
16
+ runs-on : ubuntu-24 .04
17
17
strategy :
18
18
matrix :
19
- architecture : [linux-amd64, linux-arm64, linux-arm-v7 ]
19
+ architecture : [linux-amd64, linux-arm64]
20
20
outputs :
21
21
version : ${{ steps.prep.outputs.version }}
22
22
branch : ${{ steps.prep.outputs.branch }}
23
+ time : ${{ steps.vars.outputs.time }}
23
24
steps :
24
25
- name : Checkout
25
- uses : actions/checkout@v3
26
+ uses : actions/checkout@v4
26
27
27
28
- name : Check if architecture exists
28
29
id : arch_check
29
30
run : |
30
31
(test -f Dockerfile.${{ matrix.architecture }} && echo "check=passed" >> $GITHUB_OUTPUT) || echo "check=failed" >> $GITHUB_OUTPUT
31
32
32
- # Workaround for Cargo issue: https://github.com/rust-lang/cargo/issues/8719
33
- - name : Set Swap Space
34
-
35
- with :
36
- swap-size-gb : 10
37
- - run : |
38
- sudo mkdir -p /var/lib/docker
39
- sudo mount -t tmpfs -o size=10G none /var/lib/docker
40
- sudo systemctl restart docker
41
-
42
33
- name : Set up QEMU
43
34
if : " contains(steps.arch_check.outputs.check, 'passed')"
44
- uses : docker/setup-qemu-action@v2.1 .0
35
+ uses : docker/setup-qemu-action@v3.0 .0
45
36
46
37
- name : Set up Docker Buildx
47
38
if : " contains(steps.arch_check.outputs.check, 'passed')"
48
- uses : docker/setup-buildx-action@v2.4.1
39
+ uses : docker/setup-buildx-action@v3.3.0
49
40
with :
50
41
install : true
51
42
version : latest
52
- # Fix for https://github.com/docker/buildx/issues/1509
53
- driver-opts : image=moby/buildkit:v0.10.5 # :master
43
+ driver-opts : image=moby/buildkit:master
54
44
55
45
- name : Login to docker.io
56
46
if : " contains(steps.arch_check.outputs.check, 'passed')"
57
- uses : docker/login-action@v2.1 .0
47
+ uses : docker/login-action@v3.2 .0
58
48
with :
59
49
registry : docker.io
60
50
username : ${{ secrets.DOCKER_USERNAME }}
61
51
password : ${{ secrets.DOCKER_PASSWORD }}
62
52
63
53
- name : Login to ghcr.io
64
54
if : " contains(steps.arch_check.outputs.check, 'passed')"
65
- uses : docker/login-action@v2.1 .0
55
+ uses : docker/login-action@v3.2 .0
66
56
with :
67
57
registry : ghcr.io
68
58
username : ${{ github.repository_owner }}
@@ -96,41 +86,11 @@ jobs:
96
86
97
87
echo $GITHUB_OUTPUT
98
88
99
- - name : Build and push - Attempt 1
89
+ - name : Build and push
100
90
continue-on-error : true
101
91
if : " contains(steps.arch_check.outputs.check, 'passed')"
102
92
id : build_attempt1
103
-
104
- with :
105
- push : true
106
- platforms : ${{ steps.prep.outputs.platform }}
107
- file : ./Dockerfile.${{ matrix.architecture }}
108
- cache-from : docker.io/${{ steps.prep.outputs.cache }}
109
- cache-to : docker.io/${{ steps.prep.outputs.cache }}
110
- tags : |
111
- docker.io/${{ steps.prep.outputs.tag }}
112
- ghcr.io/${{ steps.prep.outputs.tag }}
113
- labels : |
114
- org.opencontainers.image.created=${{ steps.prep.outputs.created }}
115
- org.opencontainers.image.title=${{ steps.prep.outputs.title }}
116
- org.opencontainers.image.revision=${{ steps.prep.outputs.revision }}
117
- org.opencontainers.image.source=${{ steps.prep.outputs.source }}
118
- org.opencontainers.image.vendor=${{ steps.prep.outputs.vendor }}
119
- org.opencontainers.image.url=${{ steps.prep.outputs.url }}
120
- org.opencontainers.image.version=${{ steps.prep.outputs.version }}
121
- build-args : |
122
- GITHUB_TOKEN=${{ secrets.GHCR_TOKEN }}
123
- BUILD_ARCHITECTURE=${{ matrix.architecture }}
124
- ${{ steps.prep.outputs.build-args }}
125
-
126
- - name : Sleep
127
- if : (steps.build_attempt1.outcome == 'failure')
128
- run : |
129
- sleep 30
130
-
131
- - name : Build and push - Attempt 2
132
- if : (steps.build_attempt1.outcome == 'failure')
133
-
93
+
134
94
with :
135
95
push : true
136
96
platforms : ${{ steps.prep.outputs.platform }}
@@ -154,32 +114,32 @@ jobs:
154
114
${{ steps.prep.outputs.build-args }}
155
115
156
116
publish :
157
- runs-on : ubuntu-22 .04
117
+ runs-on : ubuntu-24 .04
158
118
strategy :
159
119
matrix :
160
120
registry : [docker.io, ghcr.io]
161
121
needs : [build]
162
122
steps :
163
123
- name : Checkout
164
- uses : actions/checkout@v3
124
+ uses : actions/checkout@v4
165
125
166
126
- name : Login to docker.io
167
127
if : matrix.registry == 'docker.io'
168
- uses : docker/login-action@v2.1 .0
128
+ uses : docker/login-action@v3.2 .0
169
129
with :
170
130
registry : docker.io
171
131
username : ${{ secrets.DOCKER_USERNAME }}
172
132
password : ${{ secrets.DOCKER_PASSWORD }}
173
133
174
134
- name : Login to ghcr.io
175
135
if : matrix.registry == 'ghcr.io'
176
- uses : docker/login-action@v2.1 .0
136
+ uses : docker/login-action@v3.2 .0
177
137
with :
178
138
registry : ghcr.io
179
139
username : ${{ github.repository_owner }}
180
140
password : ${{ secrets.GHCR_TOKEN }}
181
141
182
- - name : Create manifests - Attempt 1
142
+ - name : Create manifests
183
143
continue-on-error : true
184
144
id : manifest_attempt1
185
145
env :
@@ -189,50 +149,8 @@ jobs:
189
149
TAG=${{ needs.build.outputs.branch }}
190
150
SOURCE=${IMAGE}:${TAG}-${GITHUB_SHA:0:7}-${GITHUB_RUN_NUMBER}
191
151
VERSION=${{ needs.build.outputs.version }}
192
- BRANCH=${{ needs.build.outputs.branch }}
193
- [[ -f Dockerfile.linux-amd64 ]] && AMD64=${SOURCE}-linux-amd64
194
- [[ -f Dockerfile.linux-arm64 ]] && ARM64=${SOURCE}-linux-arm64
195
- [[ -f Dockerfile.linux-arm-v7 ]] && ARMV7=${SOURCE}-linux-arm-v7
196
- docker manifest create ${IMAGE}:${TAG} ${AMD64} ${ARM64} ${ARMV7}
197
- docker manifest push ${IMAGE}:${TAG}
198
- docker manifest create ${IMAGE}:${TAG}-${VERSION} ${AMD64} ${ARM64} ${ARMV7}
199
- docker manifest push ${IMAGE}:${TAG}-${VERSION}
200
- docker manifest create ${IMAGE}:${TAG}-${VERSION} ${AMD64} ${ARM64} ${ARMV7}
201
- docker manifest push ${IMAGE}:${TAG}-${VERSION}
202
- if [[ ${BRANCH} == master ]]; then
203
- docker manifest create ${IMAGE}:latest ${AMD64} ${ARM64} ${ARMV7}
204
- docker manifest push ${IMAGE}:latest
205
- fi
206
-
207
- - name : Sleep
208
- if : (steps.manifest_attempt1.outcome == 'failure')
209
- run : |
210
- sleep 30
211
-
212
- - name : Create manifests - Attempt 2
213
- if : (steps.manifest_attempt1.outcome == 'failure')
214
- env :
215
- DOCKER_CLI_EXPERIMENTAL : enabled
216
- run : |
217
- IMAGE=${{ matrix.registry }}/$(echo ${GITHUB_REPOSITORY} | tr '[:upper:]' '[:lower:]' | sed s/docker-//)
218
- TAG=${{ needs.build.outputs.branch }}
219
- SOURCE=${IMAGE}:${TAG}-${GITHUB_SHA:0:7}-${GITHUB_RUN_NUMBER}
220
- VERSION=${{ needs.build.outputs.version }}
221
- BRANCH=${{ needs.build.outputs.branch }}
222
- [[ -f Dockerfile.linux-amd64 ]] && AMD64=${SOURCE}-linux-amd64
223
- [[ -f Dockerfile.linux-arm64 ]] && ARM64=${SOURCE}-linux-arm64
224
- [[ -f Dockerfile.linux-arm-v7 ]] && ARMV7=${SOURCE}-linux-arm-v7
225
- docker manifest rm ${IMAGE}:${TAG} || true
226
- docker manifest create ${IMAGE}:${TAG} ${AMD64} ${ARM64} ${ARMV7}
227
- docker manifest push ${IMAGE}:${TAG}
228
- docker manifest rm ${IMAGE}:${TAG}-${VERSION} || true
229
- docker manifest create ${IMAGE}:${TAG}-${VERSION} ${AMD64} ${ARM64} ${ARMV7}
230
- docker manifest push ${IMAGE}:${TAG}-${VERSION}
231
- docker manifest rm ${IMAGE}:${TAG}-${VERSION} || true
232
- docker manifest create ${IMAGE}:${TAG}-${VERSION} ${AMD64} ${ARM64} ${ARMV7}
233
- docker manifest push ${IMAGE}:${TAG}-${VERSION}
234
- if [[ ${BRANCH} == master ]]; then
235
- docker manifest rm ${IMAGE}:latest || true
236
- docker manifest create ${IMAGE}:latest ${AMD64} ${ARM64} ${ARMV7}
237
- docker manifest push ${IMAGE}:latest
152
+ docker buildx imagetools create -t ${IMAGE}:${TAG} ${SOURCE}-linux-amd64 ${SOURCE}-linux-arm64
153
+ docker buildx imagetools create -t ${IMAGE}:${TAG}-${VERSION} ${SOURCE}-linux-amd64 ${SOURCE}-linux-arm64
154
+ if [[ ${GITHUB_REF//refs\/heads\//} == main ]]; then
155
+ docker buildx imagetools create -t ${IMAGE}:latest ${SOURCE}-linux-amd64 ${SOURCE}-linux-arm64
238
156
fi
0 commit comments