pants icon indicating copy to clipboard operation
pants copied to clipboard

docker buildx bake support

Open ysavtchouk-pf opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe. We would like to use https://docs.docker.com/build/bake/ to make our docker build process more efficient. At the moment we are using pants+docker as described here: https://www.pantsbuild.org/blog/2021/10/13/pants-pex-and-docker

Describe the solution you'd like We would like pants to support docker bake, or alternative solution to parallelize builds + caching

Describe alternatives you've considered Alternative is not to use pants.

ysavtchouk-pf avatar Aug 07 '24 07:08 ysavtchouk-pf

Thanks for filing a feature request.

Pants is entirely volunteer driven. Are you interested in contributing to extend the existing docker backend to support this?

If so, we can definitely try to provide guidance/mentorship!

huonw avatar Aug 13 '24 11:08 huonw

Pants can currently build docker images in parallel if multiple docker target are specified (ex pants package :docker0 :docker1 or pants package ::)

docker buildx bake looks to be a serialisation of the arguments to the docker build. In that way it and Pants are performing the same tasks. One approach would be to use a Synthetic target generator to parse the bake file and generate docker_image targets from it. We'd want to tag them somehow as coming from a Bake file so we could invoke the correct build command. There's already (experimental) support for using podman and separately for using buildx, I wonder if it would make sense to broaden that support for docker buildx bake as well.

lilatomic avatar Sep 05 '24 03:09 lilatomic

This issue has been open for over one year without activity and is not labeled as a bug. It has been labeled as stale to invite any further updates. If you can confirm whether the issue is still applicable to the latest version of Pants, appears in other contexts, or its priority has changed, please let us know. Please feel free to close this issue if it is no longer relevant.

github-actions[bot] avatar Oct 22 '25 12:10 github-actions[bot]