Hi I have multiple projects in my repository. One ...
# general
w
Hi I have multiple projects in my repository. One of my projects needs to include artifact files from outside the project. When I try to include that file in the Docker image, I get a "file not found" error. Could someone please tell me which path Pants uses as the context folder? Folder Structure
Copy code
config/
   |_____task/config.json
projects/
   |_____project1/
           |_______docker/Dockerfile
           |_______project1/main.py
           |_______BUILD
   |_____project2/
           |_______docker/Dockerfile
           |_______project2/main.py
           |_______BUILD
Dockerfile
Copy code
FROM ubuntu:latest

COPY config/task/ /opt/config
BUILD
Copy code
files(
    name="configs",
    sources=[
        "config/**/*",
    ],
)

docker_image(
    name="docker",
    image_tags=["{build_args.GITHUB_SHA}"],
    source="docker/Dockerfile",
    dependencies=[
        ":configs",
    ],
)
When I run the
pants package
command, I get an error saying the
config/task/
folder is not found. I've tried using relative paths in dockerfile, but it didn't work. Could someone please explain how to use a config file from outside the Pants context folder?
s
pants is designed to be reproducable, so for every build it creates a temporary directory, copies all the dependencies of
docker_image
target into this directory and uses it as the context folder
You can add something like
Copy code
COPY . /all
RUN find /all
to debug your dockerfile
w
Thank you! I will try this