From 909c477f3025eb56503ed493516d25c751867dee Mon Sep 17 00:00:00 2001 From: David Karlsson <35727626+dvdksn@users.noreply.github.com> Date: Sun, 11 Feb 2024 14:53:01 +0100 Subject: [PATCH] release: multi-platform docker image Adds a linux/arm64 platform variant to the Docker image Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com> --- .github/workflows/ci.yml | 1 + Dockerfile | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d16e721..0b0c4e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -142,6 +142,7 @@ jobs: with: push: true tags: ${{ env.DOCKER_REPO }}:${{ env.GIT_VERSION }} + platforms: linux/amd64,linux/arm64 cache-from: ${{ env.DOCKER_REPO }}:latest build-args: | VERSION=${{ env.GIT_VERSION }} diff --git a/Dockerfile b/Dockerfile index 618958f..bd8fc45 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,11 @@ ARG GO_VERSION=1.21.4 ARG TARGET=alpine:3.9 -FROM golang:${GO_VERSION}-alpine AS builder +FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine AS builder +ARG TARGETARCH +ARG TARGETOS +ENV GOOS=$TARGETOS +ENV GOARCH=$TARGETARCH RUN apk add --no-cache ca-certificates git