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.
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 fast-jar template for Dockerfile:
https://github.com/quarkusio/quarkus/blob/master/devtools/platform-descriptor-json/src/main/resources/templates/dockerfile-fast-jar.ftl
Unfortunately, the fast-jar layout does not help in case you have _multiple modules_ since those still end up in a folder (quarkus-app/lib/main) that also contains other "3rd-party" deps, including Quarkus artifacts.
/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.
@stuartwdouglas
Maybe we could put them in the app dir instead, but I am not sure if that is right either.
"right" in the sense of docker layering or do you mean something else?
What about introducing something like lib-app or app-lib?
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 app, document it and see how it goes (gathering feedback from users)?
@stuartwdouglas WDYT about ^^^ ?