billowy-crowd-24646
09/26/2023, 2:14 PMpants package ::
from the root folder. What should the correct context_root be set to, if I want it to be the <project_name> folder.. I feel like I have tried all variations but no success. Variations tried
• context_root=“./”
• context_root=“.”
• context_root=“<project_name>/”curved-television-6568
09/26/2023, 2:23 PMroot/<proj>/Dockerfile
with a COPY my_file /some/where
and a root/<proj>/BUILD
with a docker_image(context_root=".")
target defined that depends on root/<proj>/my_file
that should work.billowy-crowd-24646
09/26/2023, 2:26 PMbillowy-crowd-24646
09/26/2023, 2:26 PMFROM public.ecr.aws/docker/library/python:3.10
WORKDIR /app
COPY ./ ./
RUN pip install --no-cache-dir -r requirements.txt
curved-television-6568
09/26/2023, 2:28 PMcurved-television-6568
09/26/2023, 2:28 PMdocker_image
target to the requirements.txt file, only files that the target depends upon will be present in the build context.billowy-crowd-24646
09/26/2023, 2:29 PMdocker_image(
name="docker",
context_root="./"
)
curved-television-6568
09/26/2023, 2:29 PMDockerfile
.curved-television-6568
09/26/2023, 2:30 PMbillowy-crowd-24646
09/26/2023, 2:30 PMcurved-television-6568
09/26/2023, 2:31 PMbillowy-crowd-24646
09/26/2023, 7:31 PMdependecies
and files
but am not getting anywhere. I am assuming if I do this, then I dont need COPY . .
in my Dockerfile?billowy-crowd-24646
09/26/2023, 7:35 PMcurved-television-6568
09/26/2023, 8:20 PMCOPY
in the Dockerfile
. There’s four layers to this cake. (A) the source repository, (B) the pants execution sandbox, (C) the docker build context and (D) the docker image.
Your files start out their lives in A, you need a dependency on them from your docker_image
target in order for them to be included into B, the docker build context is always rooted somewhere in the pants execution sandbox and any files in there (except any ignored by a .dockerignore
file) will be sent to the docker daemon as the build context, C. Then during your docker build process, when the instructions in your Dockerfile
is executed any files you want in your image D from the context C needs to be `COPY`’d over as usual.curved-television-6568
09/26/2023, 8:22 PMfiles(sources=["*/**"], name="files")
and then docker_image(…, dependencies=[":files"])
and finally COPY . /files
or something along those lines.billowy-crowd-24646
09/26/2023, 8:24 PM--keep-sandboxes=always
- where on my local system do I find the sandbox. I would like to take a peekcurved-television-6568
09/26/2023, 8:24 PMbillowy-crowd-24646
09/26/2023, 8:25 PM