From b8ea94bb61bd1d53e61e176f88ecd0be8ec19b32 Mon Sep 17 00:00:00 2001 From: Pieter Hollander Date: Thu, 8 Aug 2024 11:18:26 +0200 Subject: [PATCH] Add TARGETOS and TARGETARCH to fix multi-platform compilation issue. --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index d05c839..3859d1c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,6 +11,8 @@ RUN go mod download COPY . . # Build the application for the specified target architecture +# https://www.docker.com/blog/faster-multi-platform-builds-dockerfile-cross-compilation-guide/ +ARG TARGETOS TARGETARCH RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build -o opendtu-logger . # Create a minimal runtime image