From 4b6e0b116c4ac9b888150e60dc3857b478dc2ae1 Mon Sep 17 00:00:00 2001 From: Melora Hugues Date: Sun, 29 Jan 2023 18:19:54 +0100 Subject: [PATCH] Add multi-architecture support Update the Dockerfile in order to be able to generate containers for several architectures (amd64 and arm64 for instance) using buildx. --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index d83665f..0e1db1b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,12 @@ -FROM golang:1.19 AS builder +FROM --platform=$TARGETPLATFORM golang:1.19 AS builder +ARG TARGETPLATFORM +ARG BUILDPLATFORM WORKDIR /go/src/git.faercol.me/public-ip-tracker/ COPY tracker ./ RUN CGO_ENABLED=0 make build # Replace with from scratch later on -FROM alpine:latest +FROM --platform=$TARGETPLATFORM alpine:latest WORKDIR /root COPY --from=builder go/src/git.faercol.me/public-ip-tracker/build/tracker ./