From 0ecc80c86b8afeb8f9ec397634181c407cc358bc Mon Sep 17 00:00:00 2001 From: David Mays Date: Fri, 3 May 2024 15:30:53 +0100 Subject: [PATCH] Get multi-arch builds for Router. --- .github/workflows/deploy.yml | 2 +- Dockerfile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 8322900f..5712d966 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -25,7 +25,7 @@ jobs: build-and-publish-image: if: github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, 'v') name: Build and publish image - uses: alphagov/govuk-infrastructure/.github/workflows/build-and-push-image.yml@main + uses: alphagov/govuk-infrastructure/.github/workflows/build-and-push-multiarch-image.yml@main with: gitRef: ${{ inputs.gitRef || github.event.release.tag_name }} permissions: diff --git a/Dockerfile b/Dockerfile index 55d955f9..9ce14d68 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ ARG go_registry="" ARG go_version=1.22 ARG go_tag_suffix=-alpine -FROM ${go_registry}golang:${go_version}${go_tag_suffix} AS builder +FROM --platform=$TARGETPLATFORM ${go_registry}golang:${go_version}${go_tag_suffix} AS builder ARG TARGETARCH TARGETOS ARG GOARCH=$TARGETARCH GOOS=$TARGETOS ARG CGO_ENABLED=0 @@ -18,7 +18,7 @@ RUN go build -ldflags="$go_ldflags" && \ ./router -version && \ go version -m ./router -FROM scratch +FROM --platform=$TARGETPLATFORM scratch COPY --from=builder /src/router /bin/router COPY --from=builder /usr/share/ca-certificates /usr/share/ca-certificates COPY --from=builder /etc/ssl /etc/ssl