Add multi-architecture support
All checks were successful
continuous-integration/drone/push Build is passing

Update the Dockerfile in order to be able to generate containers for
several architectures (amd64 and arm64 for instance) using buildx.
This commit is contained in:
Melora Hugues 2023-01-29 18:19:54 +01:00
parent 34b3156d64
commit 4b6e0b116c

View file

@ -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/ WORKDIR /go/src/git.faercol.me/public-ip-tracker/
COPY tracker ./ COPY tracker ./
RUN CGO_ENABLED=0 make build RUN CGO_ENABLED=0 make build
# Replace with from scratch later on # Replace with from scratch later on
FROM alpine:latest FROM --platform=$TARGETPLATFORM alpine:latest
WORKDIR /root WORKDIR /root
COPY --from=builder go/src/git.faercol.me/public-ip-tracker/build/tracker ./ COPY --from=builder go/src/git.faercol.me/public-ip-tracker/build/tracker ./