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

Image caching support for copied local files #1270

Open
mthalman opened this issue May 6, 2024 · 2 comments
Open

Image caching support for copied local files #1270

mthalman opened this issue May 6, 2024 · 2 comments

Comments

@mthalman
Copy link
Member

mthalman commented May 6, 2024

Image Builder's image caching support has the ability to determine that a Dockerfile should be rebuilt if its checksum has changed since it was last published. This checksum comparison is strictly limited to the Dockerfile, however. It doesn't handle cases where the Dockerfile is configured to copy in local files that are operated upon. Any change to those files (and not the Dockerfile) wouldn't trigger the Dockerfile to be rebuilt. There are such cases of Dockerfiles copying in local files in the buildtools-prereqs repo (example).

Image Builder should be updated to account for such file changes so that the Dockerfile can be rebuilt.

I see two options to support this:

  • Update the existing image caching implementation to support other arbitrary files beyond the Dockerfile. This could be hard to maintain because the checksums for those would need to be stored in the image info JSON file which means Image Builder needs to know which files to track. So we'd either need to statically list those files the Dockerfile depends on in the manifest or something OR Image Builder would have to dynamically derive those files by parsing the Dockerfile. Rather than parsing the Dockerfile to see what gets copied, we could have Image Builder just scan the directory (recursively) where the Dockerfile is located and track all those files.
  • Make use of the Docker BuildKit's caching feature (--cache-from, --cache-to). BuildKit isn't yet supported for Windows in current versions of Docker though.
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@lbussell
Copy link
Contributor

lbussell commented May 9, 2024

[Triage] We could also consider supporting Docker's caching on linux only, and not support any file-based caching on Windows (continue using our old solution on windows until BuildKit is supported).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

2 participants