-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Cache mount should have an option to keep data in layer #4402
Comments
Thanks for raising the issue. This will require some more investigation:
|
@ilyadh this looks like a duplicate of #1512.
I don't think this is a viable option - it's generally not a good idea to copy the entire cache into the layer history for the image, since then this will massively inflate the size of the image.
If I understand correctly, what you're saying is that there's no interoperability because you have to choose an approach of persistent storage so you can use cache mounts or ephemeral storage so you can use layer caches? Both of them do work together, but I see the dilemma. You may be interested in https://github.com/reproducible-containers/buildkit-cache-dance, which is a solution to get the cache mounts and store that in github actions so it can be fetched later. I'm going to close this since it looks like a duplicate of the above linked issue, but if for some reason it's separate, we can keep discussing and re-open 🎉 |
@jedevc Thank you for your response!
Yes, I agree. But as demonstrated with my example, GOMODCACHE is special in a way that it's both the result of running a Also, the size of the image is not a big concern here, since it's all part of a "build" stage in a multi-stage environment. This cache won't be present in the final image anyway. So all in all, I don't think this is a duplicate issue. GOMODCACHE example of this problem might be the one and only. So I understand, if you want to keep this issue closed anyway. |
Opting in to use cache mount to speed up
go mod download
requires all nextgo build
steps to mount it as well.This also makes it impossible to use buildx
--cache-from
to reuse a layer with downloaded modules in a CI environment.I've been able to workaround this issue by manually copying data from cache into layer.
In practice, it works really well, and makes it possible to both speed up builds in dev and reuse downloaded modules from previous builds in CI.
I think it's confusing that there's no interoperability between cache mounts and layer cache, you can only have one or the other.
An option to copy data from cache into layer can be a bridge between those features.
The text was updated successfully, but these errors were encountered: