Any way to make a python source target and all of ...
# general
e
Any way to make a python source target and all of its transitive internal dependencies available to a docker image?
Context: I'm building an amazon sagemaker image. Need to have the script run in amazon's python env / library versions.
Currently depending on the pex and removing the deps. This works, but most of the build time is collecting and copying the 3rdparty deps.
Copy code
COPY src.infra.ml.sagemaker/train_cnv.pex /app
RUN unzip train_cnv.pex && rm -rf PEX-INFO train_cnv.pex __main__.py .deps .bootstrap
c
Thank you for this question. This seems related to https://github.com/pantsbuild/pants/issues/13756 So, we could consider how to include any sources in the docker image, not only shell sources.
e
Ahh yes. I've also run into that issue and ended up defining a
shell_source
and
files
target for the same script so i could get linting and docker inclusion.
Related, it would be nice to make the
files
targets transitively depended on by a
docker_image
(via a
pex_binary
via a
python_library
) avaliable to the docker build context without needing to list them explicitly. https://pantsbuild.slack.com/archives/C046T6T9U/p1636515092094300
👍 1
👀 1
h
Sounds like the "thin pex" idea here might be what you want
1