-
Notifications
You must be signed in to change notification settings - Fork 385
Description
Expected Behavior
Container builds work as they do for docker and when not using DOCKER_BUILDKIT.
Seemingly tilt is not honoring the dockerfile ignore for a multi-dockerfile project appropriately as mentioned in the docs here. We're expecting that it honors Dockerfile.dev.dockerignore which is blank, but instead is falling back to .dockerignore which ignores repo:src/
Current Behavior
When working on a project with a restrictive dockerignore (see context), the build (tilt up) results in the following error
Building image
[build 1/12] FROM [ ===REDACTED=== ]/node:14.16.1-dev
[background] read source files 678.52kB [done: 238ms]
[ ===REDACTED=== ][done: 234ms]
[build 2/12] ADD . /src/ [cached]
[build 3/12] WORKDIR /src [cached]
[build 4/12] COPY yarn.lock package.json .yarnrc /src/ [cached]
[build 5/12] COPY tsconfig.json babel.config.js .node.babelrc .client.babelrc /src/ [cached]
[build 6/12] COPY npm-packages-offline-cache /src/npm-packages-offline-cache/ [cached]
[build 7/12] COPY compile/ /src/compile/ [cached]
[build 8/12] COPY assets/ /src/assets [cached]
[build 9/12] COPY webpack /src/webpack
ERROR IN: [build 9/12] COPY webpack /src/webpack
ERROR IN: [build 4/12] COPY yarn.lock package.json .yarnrc /src/
[build 10/12] COPY src /src/src
ERROR IN: [build 10/12] COPY src /src/src
ERROR IN: [build 6/12] COPY npm-packages-offline-cache /src/npm-packages-offline-cache/
ERROR IN: [build 7/12] COPY compile/ /src/compile/
ERROR IN: [build 5/12] COPY tsconfig.json babel.config.js .node.babelrc .client.babelrc /src/
Build Failed: ImageBuild: "/src" not found
The same dockerfile works when running DOCKER_BUILDKIT=0 tilt up or building the dockerfile using docker directly.
On occasion, the error is about a different folder depending on the tilt version, but the result is the same, a failed build.
Steps to Reproduce
See files mentioned in context below. Note that I manually installed the older versions due to difficulty using brew to downgrade.
Context
WORKING tilt doctor Output
$ tilt doctor
Tilt: v0.23.1, built 2021-11-19
System: darwin-amd64
---
Docker
- Host: [default]
- Server Version: 20.10.11
- API Version: 1.41
- Builder: 2
- Compose Version: v1.29.2 (build 5becea4c)
---
Kubernetes
- Env: unknown
- Context: [ ===REDACTED=== ]
- Cluster Name: [ ===REDACTED=== ]
- Namespace: ws-[ ===REDACTED=== ]
- Container Runtime: cri-o
- Version: v1.21.8
- Cluster Local Registry: none
---
Tested with the following versions:
- 0.23.0 ✅ works
- 0.23.1 ✅ works
- 0.23.2 ❌ failed
- 0.23.3 ❌ failed
- 0.23.4 ❌ failed
- 0.23.5 ❌ failed
- 0.23.6 ❌ failed
- 0.23.7 ❌ failed
- 0.23.8 (latest) ❌ failed
.dockerignore
# Ignore everything by default
*
!package.json
!docker/scripts/run.sh
# NPM
!node_modules/
# built artifacts
!bin/
!build/
!assets/
Dockerfile.dev.dockerignore
(blank, though same problem if it's updated to have a comment or `.git` in it)Dockerfile.dev
FROM REDACTED/node:14.16.1-dev as build
ADD . /src/
WORKDIR /src
COPY yarn.lock package.json .yarnrc /src/
COPY tsconfig.json babel.config.js .node.babelrc .client.babelrc /src/
COPY npm-packages-offline-cache /src/npm-packages-offline-cache/
COPY compile/ /src/compile/
COPY assets/ /src/assets
COPY webpack /src/webpack
COPY src /src/src
RUN yarn --offline --frozen-lockfile
RUN npm run dev-build
FROM build
WORKDIR /src
ADD https://REDACTED.crt /usr/local/share/ca-certificates/REDACTED.crt
RUN update-ca-certificates
ENV REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
EXPOSE 8080
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD npm run dev-build && npm run dev
service.tilt
# Feel free to modify this file if required. More info: https://docs.tilt.dev/api.html
load("../include/environment.tilt", "domain", "artifactory_dev")
load("../include/services.tilt", "service")
svc = service("REDACTED")
k8s_yaml(svc.render_starlark_k8s())
k8s_resource(
"REDACTED",
links=["https://REDACTED.{}".format(domain())],
)
docker_build(
artifactory_dev("REDACTED"),
svc.path(),
dockerfile = svc.path("Dockerfile.dev"),
live_update = [
sync(svc.path(), "/src"),
]
)About Your Use Case
A user in our org tried to resume development on an older project, and was greeted by the aforementioned error. Folks on older versions of tilt did not have a problem until they upgraded, then the result was the same. We utilize an internal tap to keep folks on the same tilt version and will downgrade folks to 0.23.1 until this issue is resolved.
It is worth noting that the dev team is looking into updating the dockerignore file, but so far their changes have increased the container size by 50MB so we're looking for path of least resistance to get working again. Internal tilt support chats also noted that by the rules in the dockerignore file, /src should be excluded, though that is not how every tool seems to interpret it (different functionality)
docker build -f Dockerfile.dev . and docker buildx build -f Dockerfile.dev . both seem to work on the above file