Docker Buildx and Multi-platform
Build and target platform arguments
Use automatic platform arguments to distinguish the build stage from the desired artifact. Redeclare target ARGs inside a stage before RUN. Local Go test does not validate the illustrative base or Dockerfile build.
Formal Syntax & Structure
docker syntaxdocker
BUILDPLATFORM / TARGETPLATFORM / TARGETOS / TARGETARCHWorking Example
Example Snippetdocker
FROM --platform=$BUILDPLATFORM golang:1.26 AS compileARG TARGETOSARG TARGETARCH