Skip to content
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

Separate layer for snapshot dependencies in quarkus-container-image-jib #14347

Closed
kekbur opened this issue Jan 17, 2021 · 11 comments · Fixed by #14362
Closed

Separate layer for snapshot dependencies in quarkus-container-image-jib #14347

kekbur opened this issue Jan 17, 2021 · 11 comments · Fixed by #14362
Assignees
Labels
Milestone

Comments

@kekbur
Copy link

kekbur commented Jan 17, 2021

Description
I have a multi-module Maven project where a Quarkus application declares snapshot dependencies to the other modules. Currently quarkus-container-image-jib lumps all jar files in target/lib together into a single Docker image layer, including the snapshot jars of my dependent modules. This makes the Docker images much less efficient than what they could be because there is 50 MB of never changing content and a few hundred kilobytes of always changing content in one layer.

As a workaround I attempted to make my snapshot builds reproducible using reproducible-build-maven-plugin, but this effort failed because jandex-maven-plugin does not generate reproducible results. Somebody wanted to make jandex builds reproducible, but that effort seems to be on hold.

Implementation ideas
quarkus-container-image-jib should generate a separate layer for jars that have SNAPSHOT in their name. The layer would be directly on top of the dependent libraries layer.

References

Adjacent discussion at #9818.

@kekbur kekbur added the kind/enhancement New feature or request label Jan 17, 2021
@ghost ghost added the area/container-image label Jan 17, 2021
@ghost
Copy link

ghost commented Jan 17, 2021

/cc @geoand

@geoand
Copy link
Contributor

geoand commented Jan 18, 2021

This is a really good idea

@geoand
Copy link
Contributor

geoand commented Jan 18, 2021

@aloubyansky is there a way we can know from the AppModel whether or not a runtime dependency is part of the "project" or not? getLocalProjectArtifacts maybe?

@gsmet
Copy link
Member

gsmet commented Jan 18, 2021

Shouldn't we put all snapshot dependencies in a separate layer, whether they're part of the project or not? They are moving targets anyway.

@geoand
Copy link
Contributor

geoand commented Jan 18, 2021

That's a good idea as well - and part of a second enhancement

@geoand geoand self-assigned this Jan 18, 2021
@gsmet
Copy link
Member

gsmet commented Jan 18, 2021

Oh, I thought it would be easier given you asked how to differentiate them :).

@geoand
Copy link
Contributor

geoand commented Jan 18, 2021

Now that I started to implement it, you are right :)

geoand added a commit to geoand/quarkus that referenced this issue Jan 18, 2021
…tainer-image with Jib

This is only done for the fast-jar for the time being because:
1) This is an optimization, not a different feature set
2) fast-jar is going to be the default soon

Fixes: quarkusio#14347
@geoand
Copy link
Contributor

geoand commented Jan 18, 2021

@gsmet I followed your advice and opened #14362

@aloubyansky
Copy link
Member

@aloubyansky is there a way we can know from the AppModel whether or not a runtime dependency is part of the "project" or not? getLocalProjectArtifacts maybe?

yes

geoand added a commit that referenced this issue Jan 19, 2021
Move snapshot dependencies to another layer when using creating a container-image with Jib
@ghost ghost added this to the 1.12 - master milestone Jan 19, 2021
@kekbur
Copy link
Author

kekbur commented Jan 19, 2021

Well, that was fast. Thanks guys.

@geoand
Copy link
Contributor

geoand commented Jan 19, 2021

Keep in mind that for the time being what you requested will only work when the version of your project (and therefore the dependencies) use the SNAPSHOT in their version.

This restriction might be lifted in later revisions of the code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants