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

.dockerignore whitelist rules not respected #2576

Closed
AndiDog opened this issue Jul 30, 2019 · 1 comment · Fixed by #2589
Closed

.dockerignore whitelist rules not respected #2576

AndiDog opened this issue Jul 30, 2019 · 1 comment · Fixed by #2589
Labels
build/docker help wanted We would love to have this done, but don't have the bandwidth, need help from contributors kind/bug Something isn't working

Comments

@AndiDog
Copy link
Contributor

AndiDog commented Jul 30, 2019

Expected behavior

Skaffold calls docker build directly so that .dockerignore file is applied as expected, including whitelist rules like

**

!/.gitmodules
!/CMakeLists.txt
!/etc/**
!/CPlusPlusCode/**
!/submodules/**

which is the recommended approach – only sync what belongs to the build to avoid rebuilds.

Actual behavior

In the above .dockerignore example, only

.gitmodules
CMakeLists.txt
Dockerfile

get transmitted in the Docker context. Far from expectation.

Information

  • Skaffold version: 0.34.1
  • Operating system: macOS
  • Contents of skaffold.yaml:
apiVersion: skaffold/v1beta13
kind: Config

build:
  artifacts:
    - image: skaffold-dockerignore-issue
      docker: {}

  tagPolicy:
    gitCommit:
      variant: AbbrevCommitSha

Steps to reproduce the behavior

See full example project at: https://github.com/AndiDog/skaffold-dockerignore-issue

Why this is important

Because builds are different in Skaffold vs. raw Docker CLI, and the good-practice whitelisting approach in .dockerignore is fully unusable.

@priyawadhwa priyawadhwa added kind/bug Something isn't working build/docker help wanted We would love to have this done, but don't have the bandwidth, need help from contributors labels Jul 31, 2019
@priyawadhwa
Copy link
Contributor

Hey @AndiDog thanks for the detailed issue and for providing the example project, I was able to reproduce this bug really easily.

On first glance, I would guess that the issue is in our WalkWorkspace function. It looks like this is failing for files specified in the .dockerignore as

!/etc/**
!/CPlusPlusCode/**
!/submodules/**

and so I'm guessing the bug could lie with this SkipDir. Would you be interested in exploring this bug and potentially submitting a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build/docker help wanted We would love to have this done, but don't have the bandwidth, need help from contributors kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants