From 218c3f3068d29e7212bf634187c703320fd5067d Mon Sep 17 00:00:00 2001 From: Dee Kryvenko Date: Sun, 14 May 2023 04:45:57 -0700 Subject: [PATCH 1/5] Enable linux/arm64 docker build and publish --- .github/workflows/publish-image.yml | 3 +++ .github/workflows/release.yml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml index bf0dbfc27e8..fa906b29403 100644 --- a/.github/workflows/publish-image.yml +++ b/.github/workflows/publish-image.yml @@ -53,6 +53,9 @@ jobs: uses: docker/build-push-action@v3 with: context: ./images + platforms: | + linux/amd64 + linux/arm64 tags: | ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.image.outputs.version }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4bf120014b5..de0c0472371 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -699,6 +699,9 @@ jobs: uses: docker/build-push-action@v3 with: context: ./images + platforms: | + linux/amd64 + linux/arm64 tags: | ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.image.outputs.version }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest From 8e609ab696c05d3e05c6dbc23fc9cd18bd5a9fb4 Mon Sep 17 00:00:00 2001 From: Dee Kryvenko Date: Sun, 14 May 2023 05:07:05 -0700 Subject: [PATCH 2/5] Fix Dockerfile for multi-arch --- images/Dockerfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/images/Dockerfile b/images/Dockerfile index d30263e3c27..267d1cd2c5a 100644 --- a/images/Dockerfile +++ b/images/Dockerfile @@ -1,14 +1,15 @@ FROM mcr.microsoft.com/dotnet/runtime-deps:6.0 as build ARG RUNNER_VERSION -ARG RUNNER_ARCH="x64" ARG RUNNER_CONTAINER_HOOKS_VERSION=0.3.1 ARG DOCKER_VERSION=20.10.23 RUN apt update -y && apt install curl unzip -y WORKDIR /actions-runner -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 \ +RUN export RUNNER_ARCH=${TARGETARCH} \ + && if [ "$RUNNER_ARCH" = "amd64" ]; then export RUNNER_ARCH=x64 ; fi \ + 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 \ && tar xzf ./runner.tar.gz \ && rm runner.tar.gz @@ -16,9 +17,10 @@ RUN curl -f -L -o runner-container-hooks.zip https://github.com/actions/runner-c && unzip ./runner-container-hooks.zip -d ./k8s \ && rm runner-container-hooks.zip -RUN export DOCKER_ARCH=x86_64 \ +RUN export RUNNER_ARCH=${TARGETARCH} \ + && if [ "$RUNNER_ARCH" = "amd64" ]; then export DOCKER_ARCH=x64 ; fi \ && if [ "$RUNNER_ARCH" = "arm64" ]; then export DOCKER_ARCH=aarch64 ; fi \ - && curl -fLo docker.tgz https://download.docker.com/linux/static/stable/${DOCKER_ARCH}/docker-${DOCKER_VERSION}.tgz \ + && curl -fLo docker.tgz https://download.docker.com/${TARGETOS}/static/stable/${DOCKER_ARCH}/docker-${DOCKER_VERSION}.tgz \ && tar zxvf docker.tgz \ && rm -rf docker.tgz From 660637ce0ea1ecb6da328d42e5649a77b790450a Mon Sep 17 00:00:00 2001 From: Dee Kryvenko Date: Sun, 14 May 2023 05:22:25 -0700 Subject: [PATCH 3/5] Fix Dockerfile - missing args --- images/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/images/Dockerfile b/images/Dockerfile index 267d1cd2c5a..9381acc397e 100644 --- a/images/Dockerfile +++ b/images/Dockerfile @@ -1,5 +1,7 @@ FROM mcr.microsoft.com/dotnet/runtime-deps:6.0 as build +ARG TARGETOS +ARG TARGETARCH ARG RUNNER_VERSION ARG RUNNER_CONTAINER_HOOKS_VERSION=0.3.1 ARG DOCKER_VERSION=20.10.23 @@ -9,7 +11,7 @@ RUN apt update -y && apt install curl unzip -y WORKDIR /actions-runner RUN export RUNNER_ARCH=${TARGETARCH} \ && if [ "$RUNNER_ARCH" = "amd64" ]; then export RUNNER_ARCH=x64 ; fi \ - 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 \ + && 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 \ && tar xzf ./runner.tar.gz \ && rm runner.tar.gz From 131793bca0c32f049cb4ad4c9989ca17193058cc Mon Sep 17 00:00:00 2001 From: Dee Kryvenko Date: Sun, 14 May 2023 05:25:45 -0700 Subject: [PATCH 4/5] Fix Dockerfile - Docker likes x86_64 --- images/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/Dockerfile b/images/Dockerfile index 9381acc397e..ad9f797f2d7 100644 --- a/images/Dockerfile +++ b/images/Dockerfile @@ -20,7 +20,7 @@ RUN curl -f -L -o runner-container-hooks.zip https://github.com/actions/runner-c && rm runner-container-hooks.zip RUN export RUNNER_ARCH=${TARGETARCH} \ - && if [ "$RUNNER_ARCH" = "amd64" ]; then export DOCKER_ARCH=x64 ; fi \ + && if [ "$RUNNER_ARCH" = "amd64" ]; then export DOCKER_ARCH=x86_64 ; fi \ && if [ "$RUNNER_ARCH" = "arm64" ]; then export DOCKER_ARCH=aarch64 ; fi \ && curl -fLo docker.tgz https://download.docker.com/${TARGETOS}/static/stable/${DOCKER_ARCH}/docker-${DOCKER_VERSION}.tgz \ && tar zxvf docker.tgz \ From 2ad87b05203fa2338b7f1b8fd9b1a23458ec6efc Mon Sep 17 00:00:00 2001 From: Dee Kryvenko Date: Sun, 23 Jul 2023 18:58:17 -0700 Subject: [PATCH 5/5] Remove unused `RUNNER_ARCH` --- images/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/images/Dockerfile b/images/Dockerfile index edfd100f211..1ed0f4a9c3e 100644 --- a/images/Dockerfile +++ b/images/Dockerfile @@ -5,7 +5,6 @@ ARG TARGETOS ARG TARGETARCH ARG RUNNER_VERSION ARG RUNNER_CONTAINER_HOOKS_VERSION=0.3.2 -ARG RUNNER_ARCH="x64" ARG DOCKER_VERSION=20.10.23 RUN apt update -y && apt install curl unzip -y