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

chore: Added Dockerfiles to .dockerignore #11408

Merged

Conversation

hbelmiro
Copy link
Contributor

Since we're copying all files into the images, when we change anything in a Dockerfile, the container engine invalidates the cached layer at the COPY . . point. That makes subsequent builds unnecessarily long having to copy and build everything again, even when no source code was changed.

This PR adds Dockerfiles to .dockerignore so they are ignored when running COPY . .. That way we leverage the existing caches when no source code was changed.

Checklist:

Copy link

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@github-actions github-actions bot added the ci-passed All CI tests on a pull request have passed label Nov 26, 2024
@rimolive
Copy link
Member

/lgtm

@HumairAK
Copy link
Collaborator

For the curious on docs for this:

You can use the .dockerignore file to exclude the Dockerfile and .dockerignore files. These files are still sent to the builder as they're needed for running the build. But you can't copy the files into the image using ADD, COPY, or bind mounts. [1]

Since we don't keep any Dockerifles in the root, and all builds specify via -f, this should, I think, be a fairly safe change.

/lgtm
/approve

Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: franciscojavierarceo, HumairAK

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow bot merged commit da02858 into kubeflow:master Nov 26, 2024
6 checks passed
@hbelmiro hbelmiro deleted the add-dockerfiles-to-dockerignore branch November 26, 2024 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved ci-passed All CI tests on a pull request have passed lgtm size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants