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

future-oxygen-10553

05/15/2023, 2:00 PM
Is there a way to pass additional CLI arguments to the
docker build
command generated by a
docker image
target? For some reasons I’m installing dependencies into my image with
pip
. I’d like to be able to cache those layers in the GitHub Actions cache, but to do that I need to set the
--cache-to
and
--cache-from
options on the CLI. See: https://docs.docker.com/build/cache/backends/local/ Is that possible in the
BUILD
or
pants.toml
file? I didn’t see an option that looked like a generic
args
thing, although I do see the appropriate mixin classes in
backend/docker/target_types.py
c

curved-television-6568

05/15/2023, 3:11 PM
the current answer is unfortunately no. The next best thing as work around that has been explored is to use a
docker
shim script where you may hi-jack the build command and tweaks the args as appropriate for you.
f

future-oxygen-10553

05/15/2023, 4:28 PM
Thanks @curved-television-6568!
I’ll look into that. Is there appetite for adding this to pants directly?
c

curved-television-6568

05/15/2023, 5:13 PM
There’s a need for fixing this for sure. I’m not currently on a system using Docker, so my contributions towards that backend is very limited for the time being however.
f

future-oxygen-10553

05/15/2023, 5:18 PM
If this is something the project overall is interested in, I might be able to squeeze a few hours from my employer to look at it
c

curved-television-6568

05/15/2023, 5:21 PM
Thanks, yea that would be great. Also, I’ll be available if you’d need any guidance along the way.
f

future-oxygen-10553

05/15/2023, 5:21 PM
Thanks!
b

broad-processor-92400

05/15/2023, 11:09 PM
f

future-oxygen-10553

05/16/2023, 12:09 AM
Thanks!
3 Views