Skip to content

Commit a61d3f3

Browse files
authored
Enable linux/arm64 docker build and publish (#2601)
* Enable linux/arm64 docker build and publish * Fix Dockerfile for multi-arch * Fix Dockerfile - missing args * Fix Dockerfile - Docker likes x86_64 * Remove unused `RUNNER_ARCH` --------- Signed-off-by: Dee Kryvenko <[email protected]>
1 parent e30b9d6 commit a61d3f3

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

.github/workflows/publish-image.yml

+3
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ jobs:
5353
uses: docker/build-push-action@v3
5454
with:
5555
context: ./images
56+
platforms: |
57+
linux/amd64
58+
linux/arm64
5659
tags: |
5760
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.image.outputs.version }}
5861
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest

.github/workflows/release.yml

+3
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,9 @@ jobs:
699699
uses: docker/build-push-action@v3
700700
with:
701701
context: ./images
702+
platforms: |
703+
linux/amd64
704+
linux/arm64
702705
tags: |
703706
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.image.outputs.version }}
704707
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest

images/Dockerfile

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,29 @@
11
# Source: https://github.com/dotnet/dotnet-docker
22
FROM mcr.microsoft.com/dotnet/runtime-deps:6.0-jammy as build
33

4+
ARG TARGETOS
5+
ARG TARGETARCH
46
ARG RUNNER_VERSION
5-
ARG RUNNER_ARCH="x64"
67
ARG RUNNER_CONTAINER_HOOKS_VERSION=0.3.2
78
ARG DOCKER_VERSION=20.10.23
89

910
RUN apt update -y && apt install curl unzip -y
1011

1112
WORKDIR /actions-runner
12-
RUN curl -f -L -o runner.tar.gz https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-${RUNNER_ARCH}-${RUNNER_VERSION}.tar.gz \
13+
RUN export RUNNER_ARCH=${TARGETARCH} \
14+
&& if [ "$RUNNER_ARCH" = "amd64" ]; then export RUNNER_ARCH=x64 ; fi \
15+
&& curl -f -L -o runner.tar.gz https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-${TARGETOS}-${RUNNER_ARCH}-${RUNNER_VERSION}.tar.gz \
1316
&& tar xzf ./runner.tar.gz \
1417
&& rm runner.tar.gz
1518

1619
RUN curl -f -L -o runner-container-hooks.zip https://github.com/actions/runner-container-hooks/releases/download/v${RUNNER_CONTAINER_HOOKS_VERSION}/actions-runner-hooks-k8s-${RUNNER_CONTAINER_HOOKS_VERSION}.zip \
1720
&& unzip ./runner-container-hooks.zip -d ./k8s \
1821
&& rm runner-container-hooks.zip
1922

20-
RUN export DOCKER_ARCH=x86_64 \
23+
RUN export RUNNER_ARCH=${TARGETARCH} \
24+
&& if [ "$RUNNER_ARCH" = "amd64" ]; then export DOCKER_ARCH=x86_64 ; fi \
2125
&& if [ "$RUNNER_ARCH" = "arm64" ]; then export DOCKER_ARCH=aarch64 ; fi \
22-
&& curl -fLo docker.tgz https://download.docker.com/linux/static/stable/${DOCKER_ARCH}/docker-${DOCKER_VERSION}.tgz \
26+
&& curl -fLo docker.tgz https://download.docker.com/${TARGETOS}/static/stable/${DOCKER_ARCH}/docker-${DOCKER_VERSION}.tgz \
2327
&& tar zxvf docker.tgz \
2428
&& rm -rf docker.tgz
2529

0 commit comments

Comments
 (0)