Skip to content

Commit 54ad093

Browse files
INFRAPRJ-7379: Add arm64 host builder for 'ledgerhq/speculos' image
1 parent 710f438 commit 54ad093

File tree

2 files changed

+73
-4
lines changed

2 files changed

+73
-4
lines changed

.github/workflows/continuous-integration-workflow.yml

Lines changed: 73 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,30 @@ jobs:
151151

152152
deploy_docker:
153153
name: Build and Upload the Speculos docker
154-
runs-on: ubuntu-latest
154+
strategy:
155+
matrix:
156+
include:
157+
- platform: linux/amd64
158+
runner: ubuntu-latest
159+
- platform: linux/arm64
160+
runner: speculos-builder-2c-arm64-ubuntu_2404
161+
runs-on: ${{ matrix.runner }}
155162
needs: [build]
156163
steps:
164+
165+
- name: Prepare
166+
run: |
167+
platform=${{ matrix.platform }}
168+
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
169+
170+
if [[ "${{ github.event_name }}" == 'push' && ( "${{ github.ref }}" == 'refs/heads/master' || "${{ github.ref }}" =~ '^refs/tags/.*' ) ]]; then
171+
PUSH_FLAG='true'
172+
else
173+
PUSH_FLAG='false'
174+
fi
175+
echo "PUSH_FLAG=${PUSH_FLAG}" >> $GITHUB_ENV
176+
177+
157178
- name: Clone
158179
uses: actions/checkout@v4
159180
with:
@@ -182,8 +203,57 @@ jobs:
182203
password: ${{ secrets.GITHUB_TOKEN }}
183204

184205
- name: Build and publish to GitHub Packages
185-
uses: docker/build-push-action@v3
206+
uses: docker/build-push-action@v6
207+
id: buildPush
186208
with:
187-
push: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) }}
188209
tags: ${{ steps.meta.outputs.tags }}
189210
labels: ${{ steps.meta.outputs.labels }}
211+
platforms: ${{ matrix.platform }}
212+
outputs: type=image,name=ghcr.io/ledgerhq/speculos,push-by-digest=true,name-canonical=true,push=${{ env.PUSH_FLAG }}
213+
214+
- name: Export digest
215+
run: |
216+
mkdir -p /tmp/digests
217+
digest="${{ steps.buildPush.outputs.digest }}"
218+
touch "/tmp/digests/${digest#sha256:}"
219+
220+
- name: Upload digest
221+
uses: actions/upload-artifact@v4
222+
with:
223+
name: digests-${{ env.PLATFORM_PAIR }}
224+
path: /tmp/digests/*
225+
if-no-files-found: error
226+
retention-days: 1
227+
228+
final_tag_multiarch_merge_docker:
229+
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) }}
230+
needs:
231+
- deploy_docker
232+
runs-on: ubuntu-latest
233+
steps:
234+
- name: Download digests
235+
uses: actions/download-artifact@v4
236+
with:
237+
path: /tmp/digests
238+
pattern: digests-*
239+
merge-multiple: true
240+
241+
- name: Login to GitHub Container Registry
242+
uses: docker/login-action@v3
243+
with:
244+
registry: ghcr.io
245+
username: ${{ github.actor }}
246+
password: ${{ secrets.GITHUB_TOKEN }}
247+
248+
- name: Set up Docker Buildx
249+
uses: docker/setup-buildx-action@v3
250+
251+
- name: Create manifest list and push
252+
working-directory: /tmp/digests
253+
run: |
254+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
255+
$(printf 'ghcr.io/ledgerhq/speculos@sha256:%s ' *)
256+
257+
- name: Inspect image
258+
run: |
259+
docker buildx imagetools inspect ghcr.io/ledgerhq/speculos:latest

.github/workflows/speculos-builder.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ jobs:
2727
runner: ubuntu-latest
2828
- platform: linux/arm64
2929
runner: speculos-builder-2c-arm64-ubuntu_2404
30-
3130
runs-on: ${{ matrix.runner }}
3231
permissions:
3332
packages: write

0 commit comments

Comments
 (0)