Skip to content

Commit d640cf8

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.
1 parent a020069 commit d640cf8

File tree

5 files changed

+38
-13
lines changed

5 files changed

+38
-13
lines changed

.github/workflows/ci.yml

Lines changed: 16 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,7 @@ jobs:
532544
file: ${{ env.DOCKER_FILE }}
533545
push: ${{ env.PUSH_PACKAGES }}
534546
tags: ${{ steps.meta.outputs.tags }}
547+
platforms: linux/amd64,linux/arm64
535548

536549
publish-crate-test:
537550
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)