paketo-buildpacks / spring-boot

A Cloud Native Buildpack that contributes Spring Boot dependency information and slices an application into multiple layers
Apache License 2.0
178 stars 21 forks source link

performance layer includes chunky `runner.jar` file #505

Open cmdjulian opened 3 months ago

cmdjulian commented 3 months ago

Expected Behaviour

Not quite sure if this even is a bug or a limitation I'm simply not aware of. When building an image with the new spring boot support for cds which shipped with 3.3, the image is generated correctly and works as expected. I was just wondering why the image gets so big. In my case the has a size of roughly 650MB. Without cds it is "just" 400MB. After diging a bit I found out there is an additional launcher jar which gets contributed to the 'Performance' layer. This jar is quite big with 120MB. It seems like it is not relvant for runtime, but for generating the cds training run. Is there a specific reason this gets included in the final image? It feels like a waste of space. Roughly 20% of the image storage requirements are from this. That the application layers contains because of the jsa file for the cds data much more content is expected, having the performance layer do so too, is not to me. I used the dive tool to visualize the images content.

grafik grafik

Current Behaviour

jar is included within the performance image layer of the final image

Possible Solution

Is the jar archive strictly necessary or can it be omitted?

Steps to Reproduce

Build any image for a Spring Boot app setting BP_JVM_CDS_ENABLED=true

Motivations

I think one is expecting the smallest possible image when using the tiny builder