tilt icon indicating copy to clipboard operation
tilt copied to clipboard

dockerignore with globs creates empty folders

Open cl3m0 opened this issue 1 year ago • 3 comments

Expected Behavior

Tilt should behave same as docker when using .dockerignore files. In particular it should be able to use the ** pattern to ignore all files and directories but allow the ! pattern to include specific files.

Current Behavior

When using the ** pattern of .dockerignore to exclude everything, including a folder containing some files, in combination with the ! pattern to include some files using a glob (*), the folder is not ignored but created without containing files. i.e.

# exclude all files
**

# include only files matching pattern
!file*.txt

Steps to Reproduce

  1. Checkout project from https://github.com/bettermarks/tilt-dockerignore
  2. Run tilt up
  3. Check the logs for the output of ls -al

Context

tilt doctor Output

$ tilt doctor
Tilt: v0.33.16, built 2024-06-07
System: linux-amd64
---
Docker
- Host: unix:///var/run/docker.sock
- Server Version: 26.1.4
- API Version: 1.45
- Builder: 2
- Compose Version: v2.27.1
---
Kubernetes
- Env: kind
- Cluster Name: kind-bm-local
- Container Runtime: containerd
- Version: v1.27.3
- Cluster Local Registry: &RegistryHosting{Host:localhost:5002,HostFromClusterNetwork:ctlptl-registry:5000,HostFromContainerRuntime:,Help:https://github.com/tilt-dev/ctlptl,SingleName:,}
---

About Your Use Case

We were facing this issue when Tilt was copying a local python virtualenv folder to the image containing empty site-package folders which led to failures starting the python project.

cl3m0 avatar Jun 12 '24 11:06 cl3m0

...also to mention: docker build works as expected

diefans avatar Jun 12 '24 14:06 diefans

thanks for the report! ya, i can repro

nicks avatar Jun 18 '24 01:06 nicks

ah, i remember this, this is related to https://github.com/docker/compose/pull/11426. if you don't create the empty directory, buildkit explodes. we have to unwind some vendor deps to get the fix, and then we can remove the dir.

nicks avatar Jun 18 '24 19:06 nicks