kubernetes-in-action-2nd-edition
kubernetes-in-action-2nd-edition copied to clipboard
Chapter07: Use TARGETPLATFORM instead of BUILDPLATFORM in Dockerfile(s)
It would be more versatile if the global scope arg TARGETPLATFORM were used instead of BUILDPLATFORM in the Dockerfiles, e.g. here, for building quiz-api-0.1, etc. This would allow the user to build the image targeting a specific architecture, rather than the architecture they are building on. For example, if they are on an Apple Silicon Mac but they want to build for deploying on x86 cluster nodes, they can set PLATFORM to linux/amd64 in the Makefile and the images will be built for that target architecture. As things stand, images will always be built for linux/arm64 as BUILDPLATFORM matches the current build machine.