Skip to content

Commit 864abe9

Browse files
authored
Build arm64 multiplatform images (#429)
1 parent 31e9f13 commit 864abe9

File tree

2 files changed

+234
-42
lines changed

2 files changed

+234
-42
lines changed

.github/workflows/docker.yml

+211-26
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@ env:
1717

1818
jobs:
1919
geth:
20-
runs-on: ubuntu-latest
2120
strategy:
2221
matrix:
23-
arch: [linux/amd64]
22+
settings:
23+
- arch: linux/amd64
24+
runs-on: ubuntu-24.04
25+
- arch: linux/arm64
26+
runs-on: ubuntu-24.04-arm
27+
runs-on: ${{ matrix.settings.runs-on }}
2428
steps:
2529
- name: Checkout
2630
uses: actions/checkout@v3
@@ -32,11 +36,6 @@ jobs:
3236
username: ${{ github.actor }}
3337
password: ${{ secrets.GITHUB_TOKEN }}
3438

35-
- name: Set up QEMU
36-
uses: docker/setup-qemu-action@v2
37-
with:
38-
platforms: ${{ matrix.arch }}
39-
4039
- name: Extract metadata for the Docker image
4140
id: meta
4241
uses: docker/metadata-action@v4
@@ -49,21 +48,45 @@ jobs:
4948
uses: docker/setup-buildx-action@v3
5049

5150
- name: Build and push the Docker image
51+
id: build
5252
uses: docker/build-push-action@v6
5353
with:
5454
context: .
5555
file: geth/Dockerfile
56-
push: true
57-
tags: ${{ steps.meta.outputs.tags }}
56+
tags: ${{ env.NAMESPACE }}/${{ env.GETH_DEPRECATED_IMAGE_NAME }},${{ env.NAMESPACE }}/${{ env.GETH_IMAGE_NAME }}
5857
labels: ${{ steps.meta.outputs.labels }}
59-
platforms: ${{ matrix.arch }}
58+
platforms: ${{ matrix.settings.arch }}
59+
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
60+
61+
- name: Export digest
62+
run: |
63+
mkdir -p ${{ runner.temp }}/digests
64+
digest="${{ steps.build.outputs.digest }}"
65+
touch "${{ runner.temp }}/digests/${digest#sha256:}"
66+
67+
- name: Prepare
68+
run: |
69+
platform=${{ matrix.settings.arch }}
70+
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
71+
72+
- name: Upload digest
73+
uses: actions/upload-artifact@v4
74+
with:
75+
name: digests-geth-${{ env.PLATFORM_PAIR }}
76+
path: ${{ runner.temp }}/digests/*
77+
if-no-files-found: error
78+
retention-days: 1
6079
reth:
61-
runs-on: ubuntu-latest
6280
strategy:
6381
matrix:
64-
include:
82+
settings:
6583
- arch: linux/amd64
84+
runs-on: ubuntu-24.04
6685
features: jemalloc,asm-keccak,optimism
86+
- arch: linux/arm64
87+
runs-on: ubuntu-24.04-arm
88+
features: jemalloc,optimism
89+
runs-on: ${{ matrix.settings.runs-on }}
6790
steps:
6891
- name: Checkout
6992
uses: actions/checkout@v2
@@ -86,21 +109,46 @@ jobs:
86109
uses: docker/setup-buildx-action@v3
87110

88111
- name: Build and push the Docker image
112+
id: build
89113
uses: docker/build-push-action@v6
90114
with:
91115
context: .
92116
file: reth/Dockerfile
93-
push: true
94-
tags: ${{ steps.meta.outputs.tags }}
117+
tags: ${{ env.NAMESPACE }}/${{ env.RETH_IMAGE_NAME }}
95118
labels: ${{ steps.meta.outputs.labels }}
96119
build-args: |
97-
FEATURES=${{ matrix.features }}
98-
platforms: ${{ matrix.arch }}
120+
FEATURES=${{ matrix.settings.features }}
121+
platforms: ${{ matrix.settings.arch }}
122+
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
123+
124+
- name: Export digest
125+
run: |
126+
mkdir -p ${{ runner.temp }}/digests
127+
digest="${{ steps.build.outputs.digest }}"
128+
touch "${{ runner.temp }}/digests/${digest#sha256:}"
129+
130+
- name: Prepare
131+
run: |
132+
platform=${{ matrix.settings.arch }}
133+
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
134+
135+
- name: Upload digest
136+
uses: actions/upload-artifact@v4
137+
with:
138+
name: digests-reth-${{ env.PLATFORM_PAIR }}
139+
path: ${{ runner.temp }}/digests/*
140+
if-no-files-found: error
141+
retention-days: 1
142+
99143
nethermind:
100-
runs-on: ubuntu-latest
101144
strategy:
102145
matrix:
103-
platform: [linux/amd64]
146+
settings:
147+
- arch: linux/amd64
148+
runs-on: ubuntu-24.04
149+
- arch: linux/arm64
150+
runs-on: ubuntu-24.04-arm
151+
runs-on: ${{ matrix.settings.runs-on }}
104152
steps:
105153
- name: Checkout
106154
uses: actions/checkout@v2
@@ -112,11 +160,6 @@ jobs:
112160
username: ${{ github.actor }}
113161
password: ${{ secrets.GITHUB_TOKEN }}
114162

115-
- name: Set up QEMU
116-
uses: docker/setup-qemu-action@v2
117-
with:
118-
platforms: ${{ matrix.arch }}
119-
120163
- name: Set up Docker Buildx
121164
uses: docker/setup-buildx-action@v3
122165

@@ -128,11 +171,153 @@ jobs:
128171
${{ env.NAMESPACE }}/${{ env.NETHERMIND_IMAGE_NAME }}
129172
130173
- name: Build and push the Docker image
174+
id: build
131175
uses: docker/build-push-action@v6
132176
with:
133177
context: .
134178
file: nethermind/Dockerfile
135-
push: true
136-
tags: ${{ steps.meta.outputs.tags }}
179+
tags: ${{ env.NAMESPACE }}/${{ env.NETHERMIND_IMAGE_NAME }}
137180
labels: ${{ steps.meta.outputs.labels }}
138-
platforms: ${{ matrix.arch }}
181+
platforms: ${{ matrix.settings.arch }}
182+
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
183+
184+
- name: Export digest
185+
run: |
186+
mkdir -p ${{ runner.temp }}/digests
187+
digest="${{ steps.build.outputs.digest }}"
188+
touch "${{ runner.temp }}/digests/${digest#sha256:}"
189+
190+
- name: Prepare
191+
run: |
192+
platform=${{ matrix.settings.arch }}
193+
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
194+
195+
- name: Upload digest
196+
uses: actions/upload-artifact@v4
197+
with:
198+
name: digests-nethermind-${{ env.PLATFORM_PAIR }}
199+
path: ${{ runner.temp }}/digests/*
200+
if-no-files-found: error
201+
retention-days: 1
202+
203+
204+
merge-geth:
205+
runs-on: ubuntu-latest
206+
needs:
207+
- geth
208+
steps:
209+
- name: Download digests
210+
uses: actions/download-artifact@v4
211+
with:
212+
path: ${{ runner.temp }}/digests
213+
pattern: digests-geth-*
214+
merge-multiple: true
215+
216+
- name: Log into the Container registry
217+
uses: docker/login-action@v3
218+
with:
219+
registry: ${{ env.REGISTRY }}
220+
username: ${{ github.actor }}
221+
password: ${{ secrets.GITHUB_TOKEN }}
222+
223+
- name: Set up Docker Buildx
224+
uses: docker/setup-buildx-action@v3
225+
226+
- name: Extract metadata for the Docker image
227+
id: meta
228+
uses: docker/metadata-action@v5
229+
with:
230+
images: |
231+
${{ env.NAMESPACE }}/${{ env.GETH_DEPRECATED_IMAGE_NAME }}
232+
${{ env.NAMESPACE }}/${{ env.GETH_IMAGE_NAME }}
233+
234+
- name: Create manifest list and push
235+
working-directory: ${{ runner.temp }}/digests
236+
run: |
237+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
238+
$(printf '${{ env.NAMESPACE }}/${{ env.GETH_DEPRECATED_IMAGE_NAME }}@sha256:%s ' *)
239+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
240+
$(printf '${{ env.NAMESPACE }}/${{ env.GETH_IMAGE_NAME }}@sha256:%s ' *)
241+
242+
- name: Inspect image
243+
run: |
244+
docker buildx imagetools inspect ${{ env.NAMESPACE }}/${{ env.GETH_DEPRECATED_IMAGE_NAME }}:${{ steps.meta.outputs.version }}
245+
docker buildx imagetools inspect ${{ env.NAMESPACE }}/${{ env.GETH_IMAGE_NAME }}:${{ steps.meta.outputs.version }}
246+
247+
merge-reth:
248+
runs-on: ubuntu-latest
249+
needs:
250+
- reth
251+
steps:
252+
- name: Download digests
253+
uses: actions/download-artifact@v4
254+
with:
255+
path: ${{ runner.temp }}/digests
256+
pattern: digests-reth-*
257+
merge-multiple: true
258+
259+
- name: Log into the Container registry
260+
uses: docker/login-action@v3
261+
with:
262+
registry: ${{ env.REGISTRY }}
263+
username: ${{ github.actor }}
264+
password: ${{ secrets.GITHUB_TOKEN }}
265+
266+
- name: Set up Docker Buildx
267+
uses: docker/setup-buildx-action@v3
268+
269+
- name: Extract metadata for the Docker image
270+
id: meta
271+
uses: docker/metadata-action@v5
272+
with:
273+
images: |
274+
${{ env.NAMESPACE }}/${{ env.RETH_IMAGE_NAME }}
275+
276+
- name: Create manifest list and push
277+
working-directory: ${{ runner.temp }}/digests
278+
run: |
279+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
280+
$(printf '${{ env.NAMESPACE }}/${{ env.RETH_IMAGE_NAME }}@sha256:%s ' *)
281+
282+
- name: Inspect image
283+
run: |
284+
docker buildx imagetools inspect ${{ env.NAMESPACE }}/${{ env.RETH_IMAGE_NAME }}:${{ steps.meta.outputs.version }}
285+
286+
merge-nethermind:
287+
runs-on: ubuntu-latest
288+
needs:
289+
- nethermind
290+
steps:
291+
- name: Download digests
292+
uses: actions/download-artifact@v4
293+
with:
294+
path: ${{ runner.temp }}/digests
295+
pattern: digests-nethermind-*
296+
merge-multiple: true
297+
298+
- name: Log into the Container registry
299+
uses: docker/login-action@v3
300+
with:
301+
registry: ${{ env.REGISTRY }}
302+
username: ${{ github.actor }}
303+
password: ${{ secrets.GITHUB_TOKEN }}
304+
305+
- name: Set up Docker Buildx
306+
uses: docker/setup-buildx-action@v3
307+
308+
- name: Extract metadata for the Docker image
309+
id: meta
310+
uses: docker/metadata-action@v5
311+
with:
312+
images: |
313+
${{ env.NAMESPACE }}/${{ env.NETHERMIND_IMAGE_NAME }}
314+
315+
- name: Create manifest list and push
316+
working-directory: ${{ runner.temp }}/digests
317+
run: |
318+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
319+
$(printf '${{ env.NAMESPACE }}/${{ env.NETHERMIND_IMAGE_NAME }}@sha256:%s ' *)
320+
321+
- name: Inspect image
322+
run: |
323+
docker buildx imagetools inspect ${{ env.NAMESPACE }}/${{ env.NETHERMIND_IMAGE_NAME }}:${{ steps.meta.outputs.version }}

.github/workflows/pr.yml

+23-16
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,20 @@ on:
66

77
jobs:
88
geth:
9-
runs-on: ubuntu-latest
109
strategy:
1110
matrix:
12-
arch: [linux/amd64]
11+
settings:
12+
- arch: linux/amd64
13+
runs-on: ubuntu-24.04
14+
- arch: linux/arm64
15+
runs-on: ubuntu-24.04-arm
16+
runs-on: ${{ matrix.settings.runs-on }}
1317
steps:
1418
- name: Checkout
1519
uses: actions/checkout@v3
1620
with:
1721
ref: ${{ github.event.pull_request.head.sha }}
1822

19-
- name: Set up QEMU
20-
uses: docker/setup-qemu-action@v2
21-
with:
22-
platforms: ${{ matrix.arch }}
23-
2423
- name: Set up Docker Buildx
2524
uses: docker/setup-buildx-action@v3
2625

@@ -30,15 +29,19 @@ jobs:
3029
context: .
3130
file: geth/Dockerfile
3231
push: false
33-
platforms: ${{ matrix.arch }}
32+
platforms: ${{ matrix.settings.arch }}
3433

3534
reth:
36-
runs-on: ubuntu-latest
3735
strategy:
3836
matrix:
39-
include:
37+
settings:
4038
- arch: linux/amd64
39+
runs-on: ubuntu-24.04
4140
features: jemalloc,asm-keccak,optimism
41+
- arch: linux/arm64
42+
runs-on: ubuntu-24.04-arm
43+
features: jemalloc,optimism
44+
runs-on: ${{ matrix.settings.runs-on}}
4245
steps:
4346
- name: Checkout
4447
uses: actions/checkout@v3
@@ -53,14 +56,18 @@ jobs:
5356
file: reth/Dockerfile
5457
push: false
5558
build-args: |
56-
FEATURES=${{ matrix.features }}
57-
platforms: ${{ matrix.arch }}
59+
FEATURES=${{ matrix.settings.features }}
60+
platforms: ${{ matrix.settings.arch }}
5861

5962
nethermind:
60-
runs-on: ubuntu-latest
6163
strategy:
6264
matrix:
63-
arch: [linux/amd64]
65+
settings:
66+
- arch: linux/amd64
67+
runs-on: ubuntu-24.04
68+
- arch: linux/arm64
69+
runs-on: ubuntu-24.04-arm
70+
runs-on: ${{ matrix.settings.runs-on}}
6471
steps:
6572
- name: Checkout
6673
uses: actions/checkout@v3
@@ -69,9 +76,9 @@ jobs:
6976
- name: Set up Docker Buildx
7077
uses: docker/setup-buildx-action@v3
7178
- name: Build the Docker image
72-
uses: docker/build-push-action@v4
79+
uses: docker/build-push-action@v6
7380
with:
7481
context: .
7582
file: nethermind/Dockerfile
7683
push: false
77-
platforms: ${{ matrix.arch }}
84+
platforms: ${{ matrix.settings.arch }}

0 commit comments

Comments
 (0)