similar to this "<ability to run tests in a docker...
# general
q
similar to this "ability to run tests in a docker container" request, I'm wondering if there is a plan to support running a pex binary target within a docker container, but without adding it to the Dockerfile manually so that the same docker image can be used for general development of many different targets. Or if there is a recommended existing flow? The end goal would be to enable developers to have as little execution environment setup on their own machines as possible and instead use the consistent docker environment that we've defined. My current flow is during local development to volume mount my local directory into a docker container, and run
docker run -it -v ... -- rm docker_image:latest './pants run <pex binary target>'
This does work, but the docker command is really wordy, and when I pass it off to my team I will probably add an interface layer with scripts orย 
make
ย to alias things. Ideally we could work only from the pants interface though! this thread seem to be related:ย https://pantsbuild.slack.com/archives/C01SPQQ2WK1/p1635265741056800 thanks!
c
There is no such plan, yet, but perhaps a similar approach could be explored as for
python_test
:
Copy code
pex_binary(..., run_in_container=":dev-env-image")
๐Ÿ‘ 1
b
Though there isn't such a plan right now, do feel free to open a feature request if you like so it can be evaluated for the roadmap.
๐Ÿ‘ 2
h
You could add all the pex_binaries to a single container and then provide an arg specifying the one you want to run? Or am I misreading the problem
๐Ÿ‘ 1
q
ah yea that's true, so move the interface into the docker container itself. thanks, that should work and does avoid the need for a separate script layer (assuming I can pass the arg into
pants run Dockerfile
). In the ideal case I guess I would like to conceptualize the docker image as a configurable env for the pex binary vs. the docker image having awareness/ownership of the pex binary, and avoid the overhead of maintaining a list of binaries in the Dockerfile vs. only directly configuring the build rules. just brainstorming ways to get away with
pants run <pex binary>
as the definitive running command for a target regardless of whether you want to run it in a container or directly on your machine, but I can file a feature request ๐Ÿ˜ƒ
๐Ÿ‘ 1
h
Long term we want Pants running natively to be able to execute work inside a local container
So your feature request will be very helpful in providing impetus for that effort