dockerignore with globs creates empty folders
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
- Checkout project from https://github.com/bettermarks/tilt-dockerignore
- Run
tilt up - 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.
...also to mention: docker build works as expected
thanks for the report! ya, i can repro
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.