From f86eb7a09271a38638a74cf78de9ee195d2a9bec Mon Sep 17 00:00:00 2001 From: inkme9 Date: Thu, 11 Jun 2026 01:21:05 +0000 Subject: [PATCH] build(marketplace): cross-compile minio for arm64 via TARGETARCH Dockerfile.marketplace hardcoded GOARCH=amd64, so buildx could not produce arm64 images. Pin the build stage to BUILDPLATFORM and cross-compile to TARGETARCH (CGO is disabled, so no cross toolchain / QEMU needed), enabling linux/amd64,linux/arm64 multiarch builds for the GCP Marketplace. Co-Authored-By: Claude Opus 4.8 (1M context) --- Dockerfile.marketplace | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Dockerfile.marketplace b/Dockerfile.marketplace index aa4c24f13..b0a36a317 100644 --- a/Dockerfile.marketplace +++ b/Dockerfile.marketplace @@ -1,5 +1,9 @@ -FROM golang:1.25.9-alpine AS build +# Build on the native host arch (BUILDPLATFORM) and cross-compile the Go binary +# to TARGETARCH. CGO is disabled below, so this needs no cross toolchain and +# avoids slow QEMU emulation. buildx injects BUILDPLATFORM/TARGETARCH. +FROM --platform=$BUILDPLATFORM golang:1.25.9-alpine AS build +ARG TARGETARCH ARG RELEASE_VERSION=2025-10-15T17-29-55Z ARG COMMIT_ID=9e49d5e7a648f00e26f2246f4dc28e6b07f8c84a ARG SHORT_COMMIT_ID=9e49d5e7a648 @@ -20,7 +24,7 @@ RUN set -eux; \ ldflags="${ldflags} -X github.com/minio/minio/cmd.ShortCommitID=${SHORT_COMMIT_ID}"; \ ldflags="${ldflags} -X github.com/minio/minio/cmd.GOPATH=/go"; \ ldflags="${ldflags} -X github.com/minio/minio/cmd.GOROOT=/usr/local/go"; \ - GOOS=linux GOARCH=amd64 go build -tags kqueue -trimpath --ldflags "${ldflags}" -o /out/minio . + GOOS=linux GOARCH=${TARGETARCH} go build -tags kqueue -trimpath --ldflags "${ldflags}" -o /out/minio . FROM alpine:3.23