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

refined-addition-53644

12/16/2021, 1:24 PM
I am trying to create a docker image and it isn't able to identify paths correctly. Please see the attached comments for more I stripped down the docker file to just add the requirements.txt from
3rdparty
. Just this
Copy code
FROM public.ecr.aws/lambda/python:3.9

RUN yum -y install gcc

COPY ./3rdparty/requirements.txt .
RUN python3 -m ensurepip \
    && pip install --no-cache-dir -r requirements.txt
I keep getting this error
Copy code
> [3/4] COPY ./3rdparty/requirements.txt .:
------
failed to compute cache key: "/3rdparty/requirements.txt" not found: not found
This is the project structure
Copy code
.
├── 3rdparty
│  ├── BUILD
│  └── requirements.txt
├── BUILD
├── docker
│  └── pyfleet-vehicle-spec
│     ├── BUILD
│     ├── docker-compose.yaml
│     └── Dockerfile_dev
├── mypy.ini
├── pants
├── pants.ci.toml
├── pants.toml
├── pyproject.toml
├── README.md
├── requirements.txt
└── src
   └── pyfleet-vehicle-spec/
Of course, any further attempt to add files and folders from
src/pyfleet-vehicle-spec
fails
The docker build target looks like this
Copy code
docker_image(
    name="pyfleet-vehicle-spec-dev",
    source="Dockerfile_dev",
    dependencies=["src/pyfleet-vehicle-spec:pyfleet-vehicle-spec-dist"],
    description="dev docker image",
)
c

curved-television-6568

12/16/2021, 1:44 PM
There’s no depdendency for a
files
target that includes
requirements.txt
from what I can see… ?
That is, there’s nothing telling us to include
requirements.txt
in the docker build context..
I’m currently working on https://github.com/pantsbuild/pants/issues/13428 to help highlight these kinds of issues 😉
r

refined-addition-53644

12/16/2021, 1:56 PM
So there is dependency on the
dependencies=["src/pyfleet-vehicle-spec:pyfleet-vehicle-spec-dist"],
Which has dependency on the requirements.txt
So in general, we can't add random files and folders until it's a dependency?
I tried to go PEx way and ran into the platform issue. Then i thought I would just copy everything and ran into this issue
Here I printed list of all dependencies (including transitive). Only took screenshot of requirements.txt based dependency though
c

curved-television-6568

12/16/2021, 2:33 PM
It is currently only direct
files
dependencies that gets included, along with
packaged
pex binaries, into the build context.
😿 1
b

busy-vase-39202

12/16/2021, 4:42 PM
We welcome feature requests! Please do feel free to open an issue so we can understand your team's needs better. Cheers!
3 Views