From e2050f8ec87f0cc21a2633feece43a04fa0b5c53 Mon Sep 17 00:00:00 2001 From: Kpa-clawbot Date: Tue, 5 May 2026 01:12:40 -0700 Subject: [PATCH] fix(docker): default BUILDPLATFORM so plain docker build works (fixes #884) (#1069) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Plain `docker build .` (no buildx) fails immediately: ``` Step 1/45 : FROM --platform=$BUILDPLATFORM golang:1.22-alpine AS builder failed to parse platform : "" is an invalid component of "": platform specifier component must match "^[A-Za-z0-9_-]+$" ``` `$BUILDPLATFORM` is only auto-populated by buildx; under plain BuildKit/`docker build` it's empty. ## Fix Add `ARG BUILDPLATFORM=linux/amd64` before the `FROM` so the variable always resolves. ## Multi-arch preserved `docker buildx build --platform=linux/arm64,linux/amd64 .` still overrides `BUILDPLATFORM` at invocation time — the ARG default only applies when the caller doesn't set one. The existing CI multi-arch workflow is unaffected. Fixes #884 Co-authored-by: meshcore-bot --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index 0a8694fc..6b5ca155 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,8 @@ # Build stage always runs natively on the builder's arch ($BUILDPLATFORM) # and cross-compiles to $TARGETOS/$TARGETARCH via Go toolchain. No QEMU. +# BUILDPLATFORM is auto-set by buildx; default to linux/amd64 so plain +# `docker build` (without buildx) doesn't fail on an empty platform string. +ARG BUILDPLATFORM=linux/amd64 FROM --platform=$BUILDPLATFORM golang:1.22-alpine AS builder ARG APP_VERSION=unknown