busy-lion-5707
02/10/2021, 1:20 AMmake deb
) to build a Debian package based on the Dockerfile like it was described in this blog post. I would like to use Pants (probably ./pants package
goal?) instead Makefile command to build a Debian package. My initial thought was to use Pants Docker plugin. There are two plugins:
• implemented by @magnificent-hamburger-46133 (works for Pants v1) - stored here,
• implemented by @flat-zoo-31952 (working for Pants v2) - discussed here.
Is it a good way of thinking or is there a better approach to solve it?
Here is the example repository with my problem. Thanks in advance for your opinions! 🙇♂️flat-zoo-31952
02/10/2021, 1:22 AMflat-zoo-31952
02/10/2021, 1:54 AMbusy-lion-5707
02/10/2021, 8:17 AMflat-zoo-31952
02/10/2021, 11:15 AM./pants
to do the building part. It might be best to just build an image with the version of python you want and the deb tools you want, and run pants inside that, with its cache directories mountedflat-zoo-31952
02/10/2021, 11:17 AMdh-virtualenv
, which works on virtualenvs. What are you thinking pants will give you here that this setup won't?busy-lion-5707
02/10/2021, 12:38 PMcommon
• I wanted to put all microservices into a monorepo and extract the common
part as a separate project to not duplicate the code across multiple repositories
• each microservice has its own Dockerfile, they are almost the same, only copied directories differ, Docker image will need to be build every time the codebase will change
• I wanted to use Pants to keep track of dependencies in a monorepo and use it to package each microservice separately into a Debian package using my current solution based on Dockerfileflat-zoo-31952
02/10/2021, 3:31 PMpython_distribution
for your projects
2. Write a deb_package target type that depends on that python distribution
3. Write a rule to copy the build wheel from your python_distribution
into a docker container, and install that wheel into a virtualenv inside the container. Make an entry point script for the container that builds the deb package with dh-virtualenv
4. Write a final rule (that depends on the previous) to run the container with proper mounts that will output a debflat-zoo-31952
02/10/2021, 3:34 PMbusy-lion-5707
02/11/2021, 5:17 PMcommon
within separated Debian packages it’s not a problem for me but I need to be careful with it because the code will be reused across all micro services.flat-zoo-31952
02/11/2021, 5:19 PMflat-zoo-31952
02/11/2021, 5:21 PMflat-zoo-31952
02/11/2021, 5:21 PMbusy-lion-5707
02/11/2021, 6:05 PMflat-zoo-31952
02/11/2021, 7:07 PMdocker run
rule could just rely on the docker build
rule that builds the image, and that's enough to link the twoflat-zoo-31952
02/11/2021, 7:08 PMGet
request for its output"hundreds-father-404
03/15/2021, 7:24 PM