quaint-telephone-89068
11/14/2022, 3:23 AMlinux/amd64 will run on x86-64 Linux systems, while linux/arm64 will run on AArch64 ones. This can be configured via the --platform argument to docker build, and defaults to the current platform: https://docs.docker.com/engine/reference/commandline/build/#options . This means that an uncustomised docker build on ARM (e.g. macOS with Apple Silicon) will build for linux/arm64.
It'd be nice to be able to control the platform for a docker_image, so that, for example, docker images that are deployed on amd64 can be built for that platform, independent of the host.
Currently, we're having to have two complete platforms JSON specs (one for amd64 and one for arm64), and build our dependency PEX for both (following https://blog.pantsbuild.org/optimizing-python-docker-deploys-using-pants/ and/or https://pex.readthedocs.io/en/v2.1.113/recipes.html#pex-app-in-a-container), which ~doubles the size of the resulting PEX, takes longer to download from a cache, and takes longer to manipulate.
Describe the solution you'd like
A platform (or similar) argument to docker_image that is passed through as docker build --platform ....
Describe alternatives you've considered
I don't know of one.
Additional context
N/A
pantsbuild/pants