quick-apartment-97325
09/14/2022, 7:25 PM2.13.0 I was using a common Dockerfile for multiple targets and referring to it with a relative path:
docker_image(
name="docker",
source="../Dockerfile.prod",
...
)
After upgrading to 2.13.0 I am now getting:
I have tried creating aCopy codeInvalidFieldException: The 'source' field in target xxx:docker should not include `../` patterns because targets can only have sources in the current directory or subdirectories
files target and including it into docker_image.dependencies but am not having any luck with that either
Is there another way I should try? Should I open an issue to track on GH?hundreds-father-404
09/14/2022, 7:26 PMdocker_image target definitions to the BUILD file in the directory with Dockerfile.prodhundreds-father-404
09/14/2022, 7:27 PM../ and it was a bug we weren't erroring. It messes up things like --changed-sincequick-apartment-97325
09/14/2022, 7:28 PMsource in this case cannot refer to a dependency file?hundreds-father-404
09/14/2022, 7:32 PMsource should still refer to Dockerfile.prod because that is the Dockerfile that you are giving metadata for. You only can't use ../ in the path to it, so thus the target definition needs to live alongside the file. Does that make sense?quick-apartment-97325
09/14/2022, 7:35 PMsource file that came from dependencies, example:
docker/
BUILD
Dockerfile.prod
xxx/
BUILD
app
yyy/
BUILD
app
then inside docker/BUILD do:
files(
name="files",
sources=["Dockerfile.prod"]
)
and inside xxx/BUILD and yyy/build do:
docker_image(
name="docker",
source="docker/Dockerfile.prod",
dependencies: ["docker:files"]
...
)witty-crayon-22786
09/14/2022, 8:28 PMhappy-kitchen-89482
09/14/2022, 9:50 PMfiles target? Just referencing the source in the docker_image target should be enough, IIRCquick-apartment-97325
09/15/2022, 1:25 PMsource Dockerfile from another target, but it did not work
I have moved the docker_image declarations into the same target directory as the Dockerfile and it is working now
Thank you for the quick help!