Docker and CI/CD · Senior · Question 73 of 75
What does the --platform=$BUILDPLATFORM trick in a builder stage achieve?
- 1It skips building for platforms the registry lacks
- 2It forces the image to run on the build machine only
- ✓Correct answer: The build stage runs natively and cross-compiles for the target
Explanation
Compile steps run at native speed, using TARGETOS and TARGETARCH to produce output for each target. Only the small final stage is per-platform.