-
Notifications
You must be signed in to change notification settings - Fork 25
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
Building image downloads JDK at every run #86
Comments
It seems that |
Problem still exists: downloads at every run
|
https://paketo.io/docs/buildpacks/configuration/#bindings https://paketo.io/docs/buildpacks/configuration/#dependency-mappings |
@nebhale can we please reconsider reopening this issue? We've got several reports around the same theme. |
Better to ask @ekcasey ? I think she had some ideas. |
I also have the same issue for building the spring-boot 3.0 native image. I added |
At first we solved this problem by |
There is a caching mechanism in the buildpacks. If you build an application, then rebuild it, the second time should not download things like the JVM. That should be cached. The cache is stored in a docker volume, if you're building with Spring Boot build tools or pack. That said, the cache does not extend across applications so if you change the application image name (a common cause of this is appending a build number or version number to the image name) then it's like building from scratch and there is no cache (cause it's scoped by the application image name). It also does not start caching until you've had a successful build, so if you build, it fails and rebuild, the rebuild will need to download again. Having said this, if you're seeing behavior to the contrary, please open a new issue and we can look into it. A note on further caching. Dependency mappings or a proxy are a good way to cache things on a broader scale. Dependency mappings are a pain, so much so, I made a tool to make managing them easier. With the tool, you can |
@dmikusa I supposed so, need to check but honestly, the image name should be the same. I have git tag in the name, but I noticed that it downloads each time, even when it does not change. Anyway, maybe it is possible to run the build inside a docker builder image? I would use that for gitlab-ci, and also that would be smarter to use the builder in that case as an environment, instead of a delegate. BTW That spring task uses docker anyway, so why just not to check if the given builder image is already present in the local repository? Or to use gradle/docker repository for that? Sorry if I am simplifying it all, but was under impression that the dependencies caching problem is already solved |
@dmikusa What do you think about it?
in general when I build 10-20 times I need to restart my laptop, otherwise I have 24 GB RAM usage of Vmmem and even docker shut down does not help. Regarding code changes, I have only changes in my source code, but without changes in the image name - at least on my side. The builder was still downloaded. I changed Spring beans because it was failing in the runtime, so maybe it impacted AOT hints for graalvm - no idea. |
It should not look like that, but it doesn't seem relevant to the current issue (#86). On the subject of JDK downloads, it is indeed depressing that we are still having this discussion in 2023. AFAIK the buildpack spec has to change to enable them to cache JDK binaries between all builds (not just successful builds of the same image). Why that hasn't happened, or why some other acceptable workaround has not emerged, is a complete mystery. The local proxy with a cache for the download is the best workaround BTW, but it's fiddly to set up and not even possible for some users. For me, personally, build times improved when the downloads started getting faster independently (either the origin of the JDK changed, or something in the internet shifted and opened up a faster path for me). But that doesn't really help the large number of users stranded on a relatively slow connection, or in a geographical location that happens to be different to the build pack authors. |
Guys, it anything planned on that issue? |
Anything :)? |
Sorry, I'm not sure what you proposing @Azbesciak The current level of caching is not ideal and as has been mentioned over and over above, we want to do better but are limited by what we can do based on the Cloud-Native buildpacks spec and lifecycle. It would be more appropriate to ask questions about this under https://github.com/buildpacks or on the CNB Slack channel. We have done the best we can for now at the Paketo-level.
There is future work to revamp how we are managing dependencies in Paketo, but the purpose of this is not to address caching issues. Again, the caching limitations need to be addressed with the CNB in the spec and lifecycle. We've really done as much as we can without changes upstream. |
@dmikusa thanks for the detailed update. Would it be possible to link directly to some open issues in the CNB space? Or highlight which parts of the spec need to change? All we see as users is frustrating downloads of stuff that seems eminently cacheable. There seems to be no way to break this cycle of finger pointing and actually make progress. |
@dsyer This is probably the closest we got to improving this situation, here, but the RFC there has not be implemented because of concerns raised after it was approved. See the note at the top. I don't think that we need the full RFC 0073 to solve the problems we're having with downloads. Another lighter-weight approach was pitched here. It has some issues yet to be worked out. First, writable caches are hard because you can have multiple buildpacks running at the same time and you also have to worry about security (cache poisoning). Second, things get more complicated from the angle of platforms like kpack that are multi-tenant. I think it could be possible that this RFC is moved forward still, but it would need some support at the CNB level, it's stalled because the individual that was helping push this forward left the project. If someone has the time and motivation to push this forward, I'd suggest getting involved on the CNB Slack and if possible joining one of their working group meetings. https://github.com/buildpacks/community#meetings I don't think there are any project-level objections to fixing this issue but the effort needs a champion to push it forward. |
I cannot make it work, and also configuration of squit to cache https requests (I know there are couple of tutorials, but none of them works for me when I place squit into docker).
there is an explicit docker image I suppose, right? bellsoft/liberica-native-image-kit-container:jdk-17-nik-22.3.2-musl |
@Azbesciak please create a new discussion thread here and explain what you're doing in detail. Thanks. https://github.com/orgs/paketo-buildpacks/discussions/categories/java-team |
It would be nice to have some caching mechanism!
from spring-projects/spring-boot#24262
The text was updated successfully, but these errors were encountered: