-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Layered container image generation #9818
Comments
cc @maxandersen |
@geoand we did this for jib, right ? Doing I for docker or rather enable it could be to just have the new "app" output split jars into well-defined folders to allow for creating a dockerfile that can just copy each well known folder / file names in separate operations. @stuartwdouglas that should fit with new devmode approach too? |
@maxandersen correct, for jib we already did that |
I guess the situation has not changed lately and nobody worked on this, right? PS: Coming from https://quarkusio.zulipchat.com/#narrow/stream/187030-users/topic/Separate.20lib.20dir.20for.20project.20deps.3F |
Not sure, but the container-image for the fast jar might already do this |
This seems to be the Unfortunately, the /cc @stuartwdouglas |
Maybe we could put them in the app dir instead, but I am not sure if that is right either. We already have this info in io.quarkus.bootstrap.model.AppModel#localProjectArtifacts so it should be a pretty simple change. |
"right" in the sense of docker layering or do you mean something else? |
Right in that maybe they should be their own layer. Maybe they could go into lib/app |
What about adding a flag which moves those "localProjectArtifacts" to |
@stuartwdouglas WDYT about ^^^ ? |
bumping this issue. +1 to have the localProjectArtifacts moved to |
@lburgazzoli you mean when using |
No, I'm talking about container-image-jib.
Where the |
Oh, now I see what you mean. So you are essentially asking for the dependencies that are part of the project to be in their own layer (I assume above the others since it changes faster)? |
Yes correct and because of smallrye/jandex#213, all the local dependency change for each build even if nothing has changed which makes the lib/main layer less effective |
I see. Do you perhaps have any samples we could use to test the feature if/when it's developed? |
This repo is a good candidate |
Thanks! I try and have a look for |
Is there a Quarkus application in any of those modules? I don't see any |
@aloubyansky in a multi-module project, is there a way to get the in-project dependencies of the Quarkus application from the application model? |
@geoand |
Actually, that might not be available during the build, given that we don't perform workspace discovery for |
In case we are adding a config option for the new layout, we could use that to enable workspace discovery for the |
I think that's a good idea |
@aloubyansky I started looking into what is needed for this and the way I could get it to work (without yet involving a config option) is with these changes: geoand@f808994 Now I am sure those are too invansive and have implications that I don't understand, so if you have suggestions on how to proceed (or if you want to take this up yourself), this would be very welcome :) |
Sure, enabling workspace discovery for all modes would make local dependencies info always available. The cost would be extra time necessary to load the workspace (all the POMs, etc). Which isn't that much. How were you thinking of implementing the rest? Changing the default lib layout or adding a config option for it? Just to clarify whether we are ending up with a config option anyway. In this case, consulting a config option that is configured in an |
The contaimer image layering part is easy. I already have code that creates a layer for "fast changing" dependencies, so I just need a way to identify them - in this case that would mean I can figure out which of the dependencies are local project dependencies. No changes to the jar layout itself are needed.
Yeah, I figured that would be the case. To be honest, I would be fine if this were only in |
The second commit in https://github.com/geoand/quarkus/tree/%239818 shows how this would be used. I tried it and it works as expected |
Ok, let's start with a build system property and system property then. I can open a PR for it this afternoon. |
Awesome, thanks! |
By leveraging the fact that Quarkus can do workspace discovery during the build, we are able to place dependencies in the workspace in a separate layer above the normal dependencies. The expectation is that the workspace dependencies will change faster than the normal dependencies. Closes: quarkusio#9818
#25941 makes use of the capability added by @aloubyansky to Quarkus bootstrap to support using a separate container image layer for local project dependencies. I should note that the file system structure is not affected, so one won't see the change reflected there. The change can be seen however using |
Add local project dependencies to a different layer for jib
Super! |
Description
Possibility to create layered container images when using JVM. Reasoning here is that those dependencies that change rarely are being shared as much as possible. Usually only app code is modified thus resulting a very small change. In addition this approach would allow (security) patching lower layers.
Implementation ideas
One way would be to use fast-jar directories directly:
layer0 contains jvm
layer1 contains boot-lib
layer2 contains quarkus
layer3 contains lib
layer4 contains app
https://blog.tratif.com/2020/05/20/spring-tips-2-layered-jars-with-spring-boot-2-3-0/
gives one example what this means in practise.
The text was updated successfully, but these errors were encountered: