cool-pencil-15506
05/20/2025, 5:34 PMpantsd .
I have a dev setup where we're using a wrapper layer to define higher-order dev commands written in Go. This layer also allows us to seamlessly execute each dev command in a disposable Docker container (disposable part is crucial as each command invocation starts/stops a separate container). So far it worked well for us as it allowed to keep dev environments pinned via Dockerfile. Howewer once we started working with Pants we noticed the overhead from Pants bootstrap that adds an uncomfortable 10sec delay to each command execution. Enabling pantsd and running commands locally has removed the delay. What I am looking for now is a way to run pantsd locally and expose it somehow inside the container. I did not find a lot of information about the pantsd in the v2 documentation which is why I'm writing here. In short, here are the questions that I'm looking an answer for:
1. Is it possible to start pantsd standalone?
2. Is it possible to specify not only pantsd connection port (--pantsd-pailgun-port) but also the IP to be to access locally running pantsd from within container?
3. What dependencies does pantsd have? Does it need Python? Or is it a pre-compiled binary?gorgeous-winter-99296
05/20/2025, 5:55 PMgorgeous-winter-99296
05/20/2025, 5:56 PMcool-pencil-15506
05/20/2025, 7:54 PM// myimage:latest
FROM rockylinux:9-minimal
RUN <install some deps>
RUN <install Pants launcher>
// Other image adjustments
When I run following commands
$ docker run --rm -v <local_workdir>:<container_workdir> myimage:latest pants package ...
// and again...
$ docker run --rm -v <local_workdir>:<container_workdir> myimage:latest pants package ...
Then I don't have to wait for pants bootstrap on the 2nd run:
Bootstrapping Pants 2.26.0
Installing pantsbuild.pants==2.26.0 into a virtual environment at ...
New virtual environment successfully created at ...cool-pencil-15506
05/20/2025, 7:55 PMlocal_store_dir and named_caches_dir to ensure that cache is reused between containers runscool-pencil-15506
05/20/2025, 7:59 PMgorgeous-winter-99296
05/20/2025, 8:02 PMpantsd, you've got pantsd running commands in that container.cool-pencil-15506
05/20/2025, 8:07 PMyou've gotOk, but this only helps avoid bootstrapping delays if the container outlives multiple commands. In my case container is ephemeral and does not outlive the command it was created to executerunning commands in that container.pantsd
gorgeous-winter-99296
05/20/2025, 8:12 PMcool-pencil-15506
05/20/2025, 8:14 PM