fresh-mechanic-68429
03/26/2024, 3:37 AMpants package and pants publish to be semantically correct for cross platform docker builds when using buildx. buildx makes that awkward by forcing the use of a single command to both package and publish in a single step
https://pantsbuild.slack.com/archives/C046T6T9U/p1711423114773989?thread_ts=1711401515.193319&cid=C046T6T9Ucurved-television-6568
03/26/2024, 8:52 AMpants package) and then building (and pushing) the multi platform image when doing pants publish. To me this makes sense, and is what I'll go for in my following notes..
Notes:
• Tweak pants package to only build for the local platform when using buildx (i.e. ignore the build_platforms field; anything else?)
• Split the build_docker_image rule so the we can re-use the part of getting the Process request for building the image as a rule helper.
• For pants publish when using buildx, use the build image rule helper to get the Process request for building, providing a flag to indicate we want to build for and push, a multi platform image.
I think that's pretty much it at a high level. Thoughts?fresh-mechanic-68429
03/26/2024, 3:51 PMnutritious-hair-72580
03/26/2024, 9:51 PMpants package should build for the platforms specified when run locally - that is a feature of buildx - to support building images for different platforms locally?
Another option might be to export the images to file (output type = 'image' from memory? ) and push them from there with publish?
But I do like the suggestion of having publish do build and publish in the case of buildx - probably makes things simpler in terms of publish not having to expect already built images laying around somewhere.fresh-mechanic-68429
03/27/2024, 1:57 AM