Skip to content

Commit 7911cb5

Browse files
committed
ci: enable multi-arch Docker images with ARM64 support via QEMU
The `docker-mithril` job builds and pushes multi-platform Docker images (`linux/amd64`, `linux/arm64`) using Docker Buildx and QEMU for emulation. Each binary is injected per architecture using `$TARGETARCH` at build time. Disable `provenance` to avoid "unknown/unknown" issue: Known behavior, provenance generation triggers a multi-platform image index, which causes the image to appear as "unknown/unknown". Disabling it ensures that only a single manifest is generated.
1 parent 46a953b commit 7911cb5

File tree

7 files changed

+75
-15
lines changed

7 files changed

+75
-15
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,12 @@ jobs:
503503
- name: Checkout
504504
uses: actions/checkout@v4
505505

506+
- name: Set up QEMU
507+
uses: docker/setup-qemu-action@v3
508+
509+
- name: Set up Docker Buildx
510+
uses: docker/setup-buildx-action@v3
511+
506512
- name: Log in to the Container registry
507513
uses: docker/login-action@v3
508514
with:
@@ -519,11 +525,17 @@ jobs:
519525
unstable
520526
type=raw,value=${{ github.base_ref || github.ref_name }}-{{sha}}
521527
522-
- name: Download built artifacts
528+
- name: Download built artifacts (Linux-X64)
523529
uses: actions/download-artifact@v4
524530
with:
525-
name: mithril-distribution-${{ runner.os }}-${{ runner.arch }}
526-
path: ${{ matrix.project }}
531+
name: mithril-distribution-Linux-X64
532+
path: ${{ matrix.project }}/bin-linux-amd64
533+
534+
- name: Download built artifacts (Linux-ARM64)
535+
uses: actions/download-artifact@v4
536+
with:
537+
name: mithril-distribution-Linux-ARM64
538+
path: ${{ matrix.project }}/bin-linux-arm64
527539

528540
- name: Build and push Docker image
529541
uses: docker/build-push-action@v6
@@ -532,6 +544,8 @@ jobs:
532544
file: ${{ env.DOCKER_FILE }}
533545
push: ${{ env.PUSH_PACKAGES }}
534546
tags: ${{ steps.meta.outputs.tags }}
547+
platforms: linux/amd64,linux/arm64
548+
provenance: false
535549

536550
publish-crate-test:
537551
strategy:

.github/workflows/pre-release.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@ jobs:
130130
- name: Checkout
131131
uses: actions/checkout@v4
132132

133+
- name: Set up QEMU
134+
uses: docker/setup-qemu-action@v3
135+
136+
- name: Set up Docker Buildx
137+
uses: docker/setup-buildx-action@v3
138+
133139
- name: Log in to the Container registry
134140
uses: docker/login-action@v3
135141
with:
@@ -150,7 +156,16 @@ jobs:
150156
uses: dawidd6/action-download-artifact@v6
151157
with:
152158
name: mithril-distribution-Linux-X64
153-
path: ${{ matrix.project }}
159+
path: ${{ matrix.project }}/bin-linux-amd64
160+
commit: ${{ github.sha }}
161+
workflow: ci.yml
162+
workflow_conclusion: success
163+
164+
- name: Download built artifacts (Linux-arm64)
165+
uses: dawidd6/action-download-artifact@v6
166+
with:
167+
name: mithril-distribution-Linux-ARM64
168+
path: ${{ matrix.project }}/bin-linux-arm64
154169
commit: ${{ github.sha }}
155170
workflow: ci.yml
156171
workflow_conclusion: success
@@ -162,6 +177,8 @@ jobs:
162177
file: ${{ env.DOCKER_FILE }}
163178
push: true
164179
tags: ${{ steps.meta.outputs.tags }}
180+
platforms: linux/amd64,linux/arm64
181+
provenance: false
165182

166183
deploy-pre-release:
167184
strategy:

.github/workflows/release.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ jobs:
3131
- name: Checkout
3232
uses: actions/checkout@v4
3333

34+
- name: Set up QEMU
35+
uses: docker/setup-qemu-action@v3
36+
37+
- name: Set up Docker Buildx
38+
uses: docker/setup-buildx-action@v3
39+
3440
- name: Log in to the Container registry
3541
uses: docker/login-action@v3
3642
with:
@@ -51,7 +57,16 @@ jobs:
5157
uses: dawidd6/action-download-artifact@v6
5258
with:
5359
name: mithril-distribution-Linux-X64
54-
path: ${{ matrix.project }}
60+
path: ${{ matrix.project }}/bin-linux-amd64
61+
commit: ${{ github.sha }}
62+
workflow: ci.yml
63+
workflow_conclusion: success
64+
65+
- name: Download built artifacts (Linux-arm64)
66+
uses: dawidd6/action-download-artifact@v6
67+
with:
68+
name: mithril-distribution-Linux-ARM64
69+
path: ${{ matrix.project }}/bin-linux-arm64
5570
commit: ${{ github.sha }}
5671
workflow: ci.yml
5772
workflow_conclusion: success
@@ -63,6 +78,8 @@ jobs:
6378
file: ${{ env.DOCKER_FILE }}
6479
push: true
6580
tags: ${{ steps.meta.outputs.tags }}
81+
platforms: linux/amd64,linux/arm64
82+
provenance: false
6683

6784
deploy-release:
6885
strategy:

mithril-aggregator/Dockerfile.ci

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# Creates a docker image to run an executable built outside of the image
22
# This relies on the fact the mithril-aggregator executable has been built
3-
# on a debian-compatible x86-64 environment
3+
# on a debian-compatible environment
44
ARG DOCKER_IMAGE_FROM=debian:12-slim
55
FROM $DOCKER_IMAGE_FROM
66

7+
# Build-time platform architecture
8+
ARG TARGETARCH
9+
710
# Create appuser
811
RUN adduser --no-create-home --disabled-password appuser
912

@@ -17,7 +20,7 @@ RUN apt-get update -y && apt-get install -y libssl-dev ca-certificates wget && a
1720
ARG CARDANO_NODE_VERSION=10.4.1
1821
ARG CARDANO_BIN_URL=https://github.com/input-output-hk/cardano-node/releases/download/$CARDANO_NODE_VERSION/cardano-node-$CARDANO_NODE_VERSION-linux.tar.gz
1922
ARG EMBED-CARDANO-CLI=0
20-
RUN if [ "$EMBED-CARDANO-CLI" = 1 ] ; then \
23+
RUN if [ "$EMBED-CARDANO-CLI" = 1 ] && [ "$TARGETARCH" = "amd64" ] ; then \
2124
wget -nv -O cardano-bin.tar.gz $CARDANO_BIN_URL \
2225
&& mkdir -p /app/bin \
2326
&& (tar xzf cardano-bin.tar.gz ./bin/cardano-cli && mv /bin/cardano-cli /app/bin) || (tar xzf cardano-bin.tar.gz ./cardano-cli && mv cardano-cli /app/bin) \
@@ -27,7 +30,7 @@ RUN if [ "$EMBED-CARDANO-CLI" = 1 ] ; then \
2730
fi
2831

2932
# Copy the executable
30-
COPY mithril-aggregator/mithril-aggregator /app/bin/mithril-aggregator
33+
COPY mithril-aggregator/bin-linux-$TARGETARCH/mithril-aggregator /app/bin/mithril-aggregator
3134

3235
# Copy the config files
3336
COPY mithril-aggregator/config /app/config

mithril-client-cli/Dockerfile.ci

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# Creates a docker image to run an executable built outside of the image
22
# This relies on the fact the mithril-client executable has been built
3-
# on a debian-compatible x86-64 environment
3+
# on a debian-compatible environment
44
ARG DOCKER_IMAGE_FROM=debian:12-slim
55
FROM $DOCKER_IMAGE_FROM
66

7+
# Build-time platform architecture
8+
ARG TARGETARCH
9+
710
# Create appuser
811
RUN adduser --disabled-password appuser
912

@@ -14,7 +17,7 @@ RUN mkdir -p /app/bin
1417
RUN apt-get update -y && apt-get install -y libssl-dev ca-certificates wget && apt-get clean && rm -rf /var/lib/apt/lists/*
1518

1619
# Copy the executable
17-
COPY mithril-client-cli/mithril-client /app/bin/mithril-client
20+
COPY mithril-client-cli/bin-linux-$TARGETARCH/mithril-client /app/bin/mithril-client
1821

1922
# Copy the config files
2023
COPY mithril-client-cli/config /app/config

mithril-relay/Dockerfile.ci

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# Creates a docker image to run an executable built outside of the image
22
# This relies on the fact the mithril-relay executable has been built
3-
# on a debian-compatible x86-64 environment
3+
# on a debian-compatible environment
44
ARG DOCKER_IMAGE_FROM=debian:12-slim
55
FROM $DOCKER_IMAGE_FROM
66

7+
# Build-time platform architecture
8+
ARG TARGETARCH
9+
710
# Create appuser
811
RUN adduser --no-create-home --disabled-password appuser
912

@@ -14,7 +17,7 @@ RUN mkdir -p /app/bin
1417
RUN apt-get update -y && apt-get install -y libssl-dev ca-certificates wget && apt-get clean && rm -rf /var/lib/apt/lists/*
1518

1619
# Copy the executable
17-
COPY mithril-relay/mithril-relay /app/bin/mithril-relay
20+
COPY mithril-relay/bin-linux-$TARGETARCH/mithril-relay /app/bin/mithril-relay
1821

1922
# Copy the config files
2023
COPY mithril-relay/config /app/config

mithril-signer/Dockerfile.ci

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# Creates a docker image to run an executable built outside of the image
22
# This relies on the fact the mithril-signer executable has been built
3-
# on a debian-compatible x86-64 environment
3+
# on a debian-compatible environment
44
ARG DOCKER_IMAGE_FROM=debian:12-slim
55
FROM $DOCKER_IMAGE_FROM
66

7+
# Build-time platform architecture
8+
ARG TARGETARCH
9+
710
# Create appuser
811
RUN adduser --no-create-home --disabled-password appuser
912

@@ -18,7 +21,7 @@ ARG CARDANO_NODE_VERSION=10.4.1
1821
ARG CARDANO_BIN_URL=https://github.com/input-output-hk/cardano-node/releases/download/$CARDANO_NODE_VERSION/cardano-node-$CARDANO_NODE_VERSION-linux.tar.gz
1922
ARG EMBED-CARDANO-CLI=0
2023
# Install cardano-cli
21-
RUN if [ "$EMBED-CARDANO-CLI" = 1 ] ; then \
24+
RUN if [ "$EMBED-CARDANO-CLI" = 1 ] && [ "$TARGETARCH" = "amd64" ] ; then \
2225
wget -nv -O cardano-bin.tar.gz $CARDANO_BIN_URL \
2326
&& mkdir -p /app/bin \
2427
&& (tar xzf cardano-bin.tar.gz ./bin/cardano-cli && mv /bin/cardano-cli /app/bin) || (tar xzf cardano-bin.tar.gz ./cardano-cli && mv cardano-cli /app/bin) \
@@ -28,7 +31,7 @@ RUN if [ "$EMBED-CARDANO-CLI" = 1 ] ; then \
2831
fi
2932

3033
# Copy the executable
31-
COPY mithril-signer/mithril-signer /app/bin/mithril-signer
34+
COPY mithril-signer/bin-linux-$TARGETARCH/mithril-signer /app/bin/mithril-signer
3235

3336
# Copy the config files
3437
COPY mithril-signer/config /app/config

0 commit comments

Comments
 (0)