Make go build TARGETOS configurable.
All checks were successful
Build Docker image / build (push) Successful in 2m16s
Build Golang packages / release (push) Successful in 2m1s

This commit is contained in:
Pieter Hollander 2024-08-08 11:19:01 +02:00
parent b8ea94bb61
commit ce336b4f85
Signed by: pieter
SSH key fingerprint: SHA256:HbX+9cBXsop9SuvL+mELd29sK+7DehFfdVweFVDtMSg

View file

@ -13,7 +13,7 @@ COPY . .
# Build the application for the specified target architecture # Build the application for the specified target architecture
# https://www.docker.com/blog/faster-multi-platform-builds-dockerfile-cross-compilation-guide/ # https://www.docker.com/blog/faster-multi-platform-builds-dockerfile-cross-compilation-guide/
ARG TARGETOS TARGETARCH ARG TARGETOS TARGETARCH
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build -o opendtu-logger . RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o opendtu-logger .
# Create a minimal runtime image # Create a minimal runtime image
FROM --platform=${TARGETPLATFORM} scratch FROM --platform=${TARGETPLATFORM} scratch