stocky-salesmen-68511
11/25/2023, 11:04 AMcurved-television-6568
11/25/2023, 3:16 PMdocker rmi -a something like that.. been a long time since I used docker now.curved-television-6568
11/25/2023, 3:19 PM-ldebug.curved-television-6568
11/25/2023, 3:22 PM.env you can add that to your image using a file target:
# BUILD
file(name="env", source=".env")
docker_image(..., dependencies=[":env"], instructions=[..., "COPY .env ..."])
There are a number of ways to set environment variables, I suggest reading the docs for more details: https://www.pantsbuild.org/docs/dockerstocky-salesmen-68511
11/25/2023, 3:45 PMstocky-salesmen-68511
11/25/2023, 4:07 PMcurved-television-6568
11/25/2023, 5:14 PM--keep-sandboxes=on_failure that way you can inspect the Dockerfile, .dockerignore and the build context provided for the docker build command. By looking in the __run.sh see if all files and arguments are as expected, to find the root of the issue.stocky-salesmen-68511
11/25/2023, 5:32 PMdocker build I am using pants package docker_image command and where can I see build context or __run.sh file ?stocky-salesmen-68511
11/25/2023, 5:49 PMfile(name='env', source='../../.env')
This gives error below:
InvalidTargetException: apps/auth/BUILD34 The 'source' field in target apps/auth:env should not include ../ patterns because targets can only have sources in the current directory or subdirectories. It was set to ../../.env. Instead, use a normalized literal file path (relative to the BUILD file).stocky-salesmen-68511
11/25/2023, 5:49 PMstocky-salesmen-68511
11/25/2023, 5:55 PMstocky-salesmen-68511
11/25/2023, 5:55 PMstocky-salesmen-68511
11/25/2023, 5:58 PMcurved-television-6568
11/25/2023, 6:51 PMWhat does normalized liletarl file path means?It's just another way of saying this (reiterating to make a point, potentially more confusing):
targets can only have sources in the current directory or subdirectories.
curved-television-6568
11/25/2023, 6:51 PMstocky-salesmen-68511
11/25/2023, 7:29 PMbroad-processor-92400
11/25/2023, 10:59 PMAlso I wanna see the logs of each instruction running in docker_image target, how to do that?The
build_verbose option allows this (although, as Andreas notes, the output isn't streamed, just shown in a batch at the end): https://www.pantsbuild.org/docs/reference-docker#build_verbose
I am trying to build docker image and I don't want to use cache is there any way I can do that?With Pants 2.18, the
build_no_cache option allows this: https://www.pantsbuild.org/docs/reference-docker#build_no_cache