From 29f5eb7e4ce588dca5ed94c27b1e586d172dbf9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bojan=20=C4=8Cekrli=C4=87?= Date: Thu, 30 Jan 2025 20:26:16 +0100 Subject: [PATCH] Fix: Always build on build platform. --- postfix-exporter-01.patch | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/postfix-exporter-01.patch b/postfix-exporter-01.patch index fec06e0..f8da945 100644 --- a/postfix-exporter-01.patch +++ b/postfix-exporter-01.patch @@ -5,7 +5,7 @@ index 75a22d8..81145c9 100644 @@ -1,8 +1,41 @@ -FROM scratch +# syntax=docker/dockerfile:1.2 -+FROM golang:1.23 AS builder ++FROM --platform=$BUILDPLATFORM golang:1.23 AS builder LABEL org.opencontainers.image.source="https://github.com/hsn723/postfix_exporter" \ org.opencontainers.image.authors="Hsn723" \ org.opencontainers.image.title="postfix_exporter" @@ -38,6 +38,7 @@ index 75a22d8..81145c9 100644 +# Since we are checking out a specific SHA hash and we know this tests have worked previously, we are quite certain that the code will work. +# Hence disabling the test here. +# RUN go test ++RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM $TARGETOS/$TARGETARCH/$TARGETVARIANT" +RUN env GOOS="${TARGETOS}" GOARCH="${TARGETARCH}" GOARM="$( echo "$TARGETVARIANT" | grep -E -o "\\d+$")" go build -ldflags '-extldflags "-static"' -o /bin/postfix_exporter + +FROM scratch