-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix .dockerignore resolution when using multiple Dockerfiles (#863)
This pushes `.dockerignore` path resolution down into `getIgnorePatterns` so it can juggle the multiple candidate ignore-files correctly. Resolution follows the behavior described [here](spec): > ...the build client looks for a file named .dockerignore in the root directory of the context. > > If you use multiple Dockerfiles, you can use different ignore-files for each Dockerfile. [...] Place your ignore-file in the same directory as the Dockerfile, and prefix the ignore-file with the name of the Dockerfile. > > A Dockerfile-specific ignore-file takes precedence over the .dockerignore file at the root of the build context if both exist. In other words, we look for a `<Dockerfile>.dockerignore` file sitting next to `<Dockerfile>`, and if that doesn't exist we fall back on the `.dockerignore` at the root of our build context. Fixes #675 [spec]: https://docs.docker.com/build/building/context/#filename-and-location
- Loading branch information
Showing
17 changed files
with
160 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
examples/test-dockerfile/dockerignore-default-fail/.dockerignore
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
examples/test-dockerfile/dockerignore-default-fail/Dockerfile
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
examples/test-dockerfile/dockerignore-default-fail/Pulumi.yaml
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
FROM scratch | ||
FROM bash | ||
|
||
COPY . / | ||
|
||
RUN [ -f "app.txt" ] | ||
|
||
RUN [ ! -f "ignore.txt" ] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
examples/test-dockerfile/dockerignore-no-mapping/Pulumi.yaml
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
FROM --platform=linux/amd64 ubuntu | ||
FROM bash | ||
|
||
COPY . / | ||
|
||
RUN [ -f "app.txt" ] | ||
|
||
RUN [ ! -f "ignore.txt" ] |
6 changes: 4 additions & 2 deletions
6
examples/test-dockerfile/dockerignore-with-external-dockerfile/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
FROM --platform=linux/amd64 ubuntu | ||
FROM bash | ||
|
||
COPY . / | ||
|
||
RUN cat app.txt | ||
RUN [ -f "app.txt" ] | ||
|
||
RUN [ ! -f "ignore.txt" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.