-
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.
Support additional .dockerignore formats (#579)
* Add function to map additional dockerignore files. Docker maps "Dockerfile" to a ".dockerignore" file, and it maps "Dockerfile-prod" to "Dockerfile-prod.dockerignore". This commit adds a function and unit tests to map the Docker project's dockerignore file to its expected location. * Add integration tests for .dockerignore While these tests cannot precisely verify whether or not a file was correctly ignored, the docker image being build can expect the existence/nonexistence of a file in the context tarball and fail accordingly. * pacify linter * remove experimental test
- Loading branch information
1 parent
b2e386a
commit e6c6872
Showing
29 changed files
with
220 additions
and
2 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: 1 addition & 0 deletions
1
examples/test-dockerfile/dockerignore-default-fail/.dockerignore
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
ignore.txt |
8 changes: 8 additions & 0 deletions
8
examples/test-dockerfile/dockerignore-default-fail/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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM --platform=linux/amd64 ubuntu | ||
|
||
COPY . / | ||
|
||
RUN cat app.txt | ||
|
||
Run cat ignore.txt | ||
|
13 changes: 13 additions & 0 deletions
13
examples/test-dockerfile/dockerignore-default-fail/Pulumi.yaml
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: dockerfile-default | ||
runtime: yaml | ||
resources: | ||
demo-image: | ||
type: docker:Image | ||
properties: | ||
imageName: pulumibot/ignore-image:tag2 | ||
skipPush: true | ||
options: | ||
version: v4.0.0 | ||
outputs: | ||
imageName: ${demo-image.imageName} | ||
out-dockerfile: ${demo-image.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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Hi! I am a test file! |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Hi! I should get ignored! |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM scratch | ||
|
||
COPY . / |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: dockerfile-default | ||
runtime: yaml | ||
resources: | ||
demo-image: | ||
type: docker:Image | ||
properties: | ||
imageName: pulumibot/ignore-image:tag1 | ||
skipPush: true | ||
options: | ||
version: v4.0.0 | ||
outputs: | ||
imageName: ${demo-image.imageName} | ||
out-dockerfile: ${demo-image.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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Hi! I am a test file! |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Hi! I should get ignored! |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM --platform=linux/amd64 ubuntu | ||
|
||
COPY . / | ||
|
||
Run cat app.txt | ||
|
||
RUN cat ignore.txt |
16 changes: 16 additions & 0 deletions
16
examples/test-dockerfile/dockerignore-no-mapping/Pulumi.yaml
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: dockerfile-default | ||
runtime: yaml | ||
resources: | ||
demo-image: | ||
type: docker:Image | ||
properties: | ||
imageName: pulumibot/ignore-image:tag4 | ||
skipPush: true | ||
build: | ||
context: . | ||
dockerfile: Mockerfile | ||
options: | ||
version: v4.0.0 | ||
outputs: | ||
imageName: ${demo-image.imageName} | ||
out-dockerfile: ${demo-image.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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Hi! I am a test file! |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Hi! I should get ignored! |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM --platform=linux/amd64 ubuntu | ||
|
||
COPY . / |
1 change: 1 addition & 0 deletions
1
examples/test-dockerfile/dockerignore-specified/Mockerfile.dockerignore
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
ignore.txt |
16 changes: 16 additions & 0 deletions
16
examples/test-dockerfile/dockerignore-specified/Pulumi.yaml
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: dockerfile-default | ||
runtime: yaml | ||
resources: | ||
demo-image: | ||
type: docker:Image | ||
properties: | ||
imageName: pulumibot/ignore-image:tag3 | ||
skipPush: true | ||
build: | ||
context: . | ||
dockerfile: Mockerfile | ||
options: | ||
version: v4.0.0 | ||
outputs: | ||
imageName: ${demo-image.imageName} | ||
out-dockerfile: ${demo-image.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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Hi! I am a test file! |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Hi! I should get ignored! |
5 changes: 5 additions & 0 deletions
5
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM --platform=linux/amd64 ubuntu | ||
|
||
COPY . / | ||
|
||
RUN cat app.txt |
16 changes: 16 additions & 0 deletions
16
examples/test-dockerfile/dockerignore-with-external-dockerfile/Pulumi.yaml
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: dockerfile-external | ||
runtime: yaml | ||
resources: | ||
demo-image: | ||
type: docker:Image | ||
properties: | ||
imageName: pulumibot/test-image:tag3 | ||
skipPush: true | ||
build: | ||
context: ./app | ||
dockerfile: ./Dockerfile | ||
options: | ||
version: v4.0.0 | ||
outputs: | ||
imageName: ${demo-image.imageName} | ||
out-dockerfile: ${demo-image.dockerfile} |
1 change: 1 addition & 0 deletions
1
examples/test-dockerfile/dockerignore-with-external-dockerfile/app/.dockerignore
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
ignore.txt |
1 change: 1 addition & 0 deletions
1
examples/test-dockerfile/dockerignore-with-external-dockerfile/app/app.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Hi! I am a test file! |
Empty file.
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
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