-
Notifications
You must be signed in to change notification settings - Fork 0
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
Ignore Dockerfile/Compose files by default #51
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this exclude Dockerfile
by default when deploying any service (assuming none of them have their own .dockerignore
) and therefore break all deployments?
@jordanstephens glad you asked! No: Lines 93 to 94 in 11e790f
|
I'm confused then. I think I'm missing some context to understand these statements:
And
What do we gain by making these changes? It's not clear from the description or from our discussion so far. |
@jordanstephens You're right there's still something missing, which is what I meant with "Should we include the .dockerignore in the build context?" The important "fix" is that we ignore the But when we (Defang) create the tarball for the builder, we always need to include the Dockerfile, since the builder needs it. That's where that extra logic comes in "we need the Dockerfile, even if it's in the .dockerignore file". What's missing is that when we use the default baked-in |
In the Kaniko case, there's a flag that we can use to ignore specific paths https://github.com/GoogleContainerTools/kaniko?tab=readme-ov-file#flag---ignore-path |
I guess I'm not sure why it matters to pull the user's Dockerfile and compose files from the tarball. I think I hear you that it's probably not necessary for the running application, but we don't actually know that. Hell, the application could read the Dockerfile or compose file at startup for some reason—we don't know. What are we fixing by removing it? |
@jordanstephens unnecessary rebuilds by leaving Dockerfile/Compose out of the built image. Note that this is the default |
Shouldn't a changed Dockerfile trigger a rebuild? |
After discussing with @lionello , he suggested following up with DefangLabs/defang#1015 so that the default |
@jordanstephens and I agreed this is a temp workaround and that the better option is to have a way for people to instantiate a |
The
Dockerfile
andcompose.*.yaml
is not needed inside the build, so we should ignore it by default. Ideally the runtime images only have runtime files in them, so no build-only artifacts. If these do get included, there are a couple of unwanted side-effects:compose.yaml
for one service would cause all services to get rebuilt if thecompose.yaml
is in their build contexts, even though only one service config got changed.compose.yaml
and these could end up being copied into the runtime container image because of aCOPY . .
statement.Dockerfile
doesn't always result in a new image, because the resulting image might be the same, but if theDockerfile
ends up being copied into the image, that it will by definition always change the image and cause a service replacement.Should we include the
.dockerignore
in the build context? This way, Kaniko will use it when it evaluatesCOPY . .
etc. But a bit tricky to be including files that weren't there to begin with. We'd have to ignore.dockerignore
itself, for one.