https://pantsbuild.org/ logo
#general
Title
# general
s

shy-advantage-49800

12/01/2021, 7:54 PM
How do I expose a port with
./pants run src/docker/Dockerfile
?
c

curved-television-6568

12/01/2021, 7:56 PM
That's a missing feature.
😢 1
s

shy-advantage-49800

12/01/2021, 7:58 PM
so run doesn't accept any docker argument?
c

curved-television-6568

12/01/2021, 8:19 PM
Would welcome input on what you think that should look like.
One way would be to simply accept arbitrary args for the run command..
But I would like something more robust, like a “run configuration” that you could pick..
a

ambitious-actor-36781

12/02/2021, 12:26 AM
I was thinking about some sort of
Procfile
or
docker-compose
system with the latter, something like
./pants docker-compose up
would determine the container dependencies, build the containers, then generate a docker-compose file and
docker-compose up
it. Then (theoretically) when something changes, rebuilds and restarts the container. Ultimately, why reinvent the wheel?
👍 1
c

curved-television-6568

12/02/2021, 8:11 AM
@ambitious-actor-36781 Thanks for that input. Would be great to have a way to use
docker-compose
to setup an entire dev/test env locally, for instance.
Still think it would make sense to have some form of control over how a single image is
run
too, though..
e

eager-dress-66405

12/02/2021, 2:08 PM
In the "short term" what about something like
./pants run $target -- $docker_run_flags
c

curved-television-6568

12/02/2021, 3:19 PM
Those
$docker_run_flags
are passed to your image entrypoint..
e

eager-dress-66405

12/02/2021, 3:26 PM
Ahh right. Double
--
? Flag after the run goal? Neither option "clean"
c

curved-television-6568

12/02/2021, 3:43 PM
you mean like
./pants run --args="-p 80 --name foo …" $target …
?
a

ambitious-actor-36781

12/02/2021, 9:10 PM
--docker-args
would be consistent with other subsystems. e.g.
--pytest-args
but then, docker is weird and has two sets of args
docker [global-opts] run [run-opts]
you'd actually need to separate the two.
c

curved-television-6568

12/03/2021, 7:27 AM
And a third level, to differentiate if it is a docker run, or build, or something else.
s

shy-advantage-49800

12/04/2021, 11:47 AM
Is there an issue for this?
c

curved-television-6568

12/04/2021, 11:51 AM
No, I don't think so. Please feel free to submit one :)
s

shy-advantage-49800

12/04/2021, 11:54 AM
sure
c

curved-television-6568

12/04/2021, 12:57 PM
Thanks.
2 Views