ancient-rose-27306
08/22/2022, 3:43 PMpython_distribution()
target and for a Docker image it should be docker_image()
target. Throwing in gRPC and Protobufs in the mixture and there I know that python_distribution()
target type will resolve the proto dependency at the time of executing package
goal. Would the target type docker_image()
do the same? Is package
the right goal for my use case here as in to build a Docker image?refined-addition-53644
08/22/2022, 4:20 PMpex_binary
is the recommended target for docker image.refined-addition-53644
08/22/2022, 4:23 PMancient-rose-27306
08/22/2022, 4:43 PMThis might be helpful.
https://blog.pantsbuild.org/pants-pex-and-docker/
GenerallyOk, what would be the workflow then? Adding the dependency ofis the recommended target for docker image.pex_binary
pex_binary()
target to the docker_image()
target?refined-addition-53644
08/22/2022, 4:56 PMpex_binary
. It's from the docs.
When you COPY PEX binaries into your image, the dependency on the pex_binary target will be inferred, so you don't have to add that explicitly to the list of dependencies on your docker_image target.
https://www.pantsbuild.org/docs/docker
refined-addition-53644
08/22/2022, 5:05 PMpex_binary
is that they are platform dependent and when you copy them inside docker, they are first built on the host not inside the docker container. So if your host is macos and you copy a PEX inside Linux docker Image, it won't work.ancient-rose-27306
08/22/2022, 5:23 PMpython_distribution()
.refined-addition-53644
08/22/2022, 5:51 PMpython_distribution
depends on then you will have to host them somewhere and then pass the necessary secrets to docker build so that it gets installed inside the image. pex_binary
bundles all 1st party and 3rd party dependencies without much from your side.ancient-rose-27306
08/22/2022, 5:53 PMpackage
goal working and see the results. I can think about the target types later once I have a clear picture in mind and I proceed towards implementing the learnings in prod.