-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Normally, buildkit would persist the cache in var/lib/buildkit inside the container/system you would run it.
In case you run it, let's say on privileged mode as a docker container, it would mount the containerd layer storage and store at that place.
However, our use case dictates buildkit to run as an ephemeral container whenever we want to build an image.
To achieve persistent cache, we need to mount cache somewhere else.
- We could use --export-cache and --import-cache flag to point the build to a registry. This is nice but there might be issues with registry rewrites on cache pushing. View the discussion here.
However, this drastically reduces the build time as base layers would be same nonetheless. The issue arises when I makeruntime py node, thenruntime node rbthen if we tryruntime py go, we won't fetch py's cache. - Building metacall has known limited languages, so after initialisation ; we could first run a build with all languages
runtime lang1 lang2 ...and simply export this to the registry and then all other subsequent builds, we only import from the registry and do not export to it, preventing rewrites. - If we don't want to do the above as the initialise build time would be higher, we could just once and for all upload the layers to docker hub or some form of hosted repos and not worry about first build at all. Simply importing in your k8s architecture. However, this won't work in an air gapped environment, so keeping 2nd as the fallback seems logical.
- We could mount a volume to the registry or any other container and store the layers as artifacts, and just provide the cache path to buildkit. However, would need to check if there are any rewrites happening if any, and if not, is it feasible. Need to experiment and look.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels