Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply dockefile exclude only for first stage #1234

Merged
merged 2 commits into from
May 19, 2020

Conversation

tejal29
Copy link
Member

@tejal29 tejal29 commented May 6, 2020

Fixes #595

Description

Only apply dockerignore file for the first stage.
Add integration test to make sure this test case isnt broken in future.

@googlebot googlebot added the cla: yes CLA signed by all commit authors label May 6, 2020
@MajorBreakfast
Copy link

MajorBreakfast commented May 6, 2020

FYI I think this PR implements it exactly like Docker: Docker seems to also respect the dockerignore only on the host filesystem. Inside intermediate container file systems it seems to treat the dockerignore like any other file. Or in other words: When copying form an intermediate container, no .dockerignore applies (neither the file on the host file system, which this PR fixes, nor one on the container file system)

How I checked this

Create file a.txt file and .dockerignore that ignores a.txt, then run this dockerfile

FROM alpine:latest AS intermediate

COPY . /
RUN ls -a # shows .dockerignore, no a.txt
RUN touch a.txt
RUN ls -a # shows .dockerignore and a.txt

FROM alpine:latest

COPY --from=intermediate . /
RUN ls -a # shows .dockerignore and a.txt

@tejal29 tejal29 merged commit 3f3c19a into GoogleContainerTools:master May 19, 2020
@tejal29 tejal29 deleted the fix_copy_from branch April 26, 2021 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes CLA signed by all commit authors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The .dockerignore file also matches between stages
3 participants