Use cross-compilation instead of emulation

This commit is contained in:
Ingo Oppermann
2024-04-02 14:32:47 +02:00
parent e3138d6e6d
commit 263504574f

View File

@@ -1,8 +1,12 @@
ARG GOLANG_IMAGE=golang:1.20-alpine3.16
ARG BUILD_IMAGE=alpine:3.16
FROM $GOLANG_IMAGE as builder
# Cross-Compilation
# https://www.docker.com/blog/faster-multi-platform-builds-dockerfile-cross-compilation-guide/
FROM --platform=$BUILDPLATFORM $GOLANG_IMAGE as builder
ARG TARGETOS TARGETARCH
ENV GOOS=$TARGETOS GOARCH=$TARGETARCH
COPY . /dist/core