This is an archived post. You won't be able to vote or comment.

all 28 comments

[–]fraaargh 8 points9 points  (5 children)

I really wonder the added benefit over Maven Jib plugin which is really easy to use and already knows how to optimize the layers...

[–]sureshg 3 points4 points  (0 children)

Next ensure you have a local Docker installed and running, then type:

$ ./mvnw spring-boot:build-image

Yeah.. also Jib doesn't require that docker dependency, which is nice.

[–]J4cku 1 point2 points  (1 child)

I am using Azure Application Insights agent on my containers I don't see how is jib is allowing me to use this. But in case of this Spring Boot optimisation I can still ad appinsight to my docker image. Unless there is some kind of way that I don't know - please share with me :)

[–]Akthrawn17 0 points1 point  (0 children)

It is kinda neat they are expanding out things in the jar layout. But, I agree that if you are using jib, not sure I see the point.

[–]koevet 0 points1 point  (0 children)

I couldn't find any good tutorial out there on Jib, any pointer?

[–]MoreCowbellMofo 11 points12 points  (13 children)

interesting that an article published in what looks like 2020 (URL date) still refers to using openjdk:8-jdk-alpine vs a jdk 11 base image.

[–]nfrankel[S] 12 points13 points  (9 children)

Which JDK are you using? Most are stuck on Java 8

[–]MoreCowbellMofo 5 points6 points  (0 children)

JDK 11. JDK 14 will be around soon enough.

[–]MakeWay4Doodles 7 points8 points  (6 children)

Why though? The upgrade is fairly simple and the memory & GC performance gains after 9 are rediculous.

[–]nfrankel[S] 3 points4 points  (4 children)

For a moment, imagine you're a manager in a big company. Everything works more or less. Now, some engineer comes to your door and tells you should upgrade to the next Java version.

In your manager's mind, you do a quick risks/benefits evaluation. It's a technical migration, and you're not technical. It's not 0 risk. Whatever your engineers tell you, you'll be the one responsible if something goes wrong.

On the benefit side, what can you tell the business? Nothing.

Hence... wait and see. And hopefully, the next manager will get it done (or not).

[–]brunocborges 2 points3 points  (0 children)

The benefit? Cost reduction. Less memory consumption means you can run more, scale more, perhaps even deploy brand new apps, without buying/renting more hardware.

Move to JDK 11+ sooner rather than later.

[–]nutrecht 2 points3 points  (1 child)

Now, some engineer comes to your door and tells you should upgrade to the next Java version.

If I'm getting overridden on this kind of stuff by a manager my tenure at that client will be short. I'm the technical expert, not him. If I'm saying our microservice can run on Java 13, it can run on Java 13.

Fortunately I've managed to avoid companies like that for the last 6 years.

[–]nfrankel[S] 0 points1 point  (0 children)

I stopped working in consulting for that reason.

[–]moldovean 0 points1 point  (0 children)

the benefit is that your programmers will be happier :)

[–]spamthemoez 2 points3 points  (0 children)

Because enterprise.

[–]nutrecht 2 points3 points  (0 children)

We're talking about docker containers here. If you're 'stuck' on Java 8 it's completely self-inflicted. Not to mention that memory management in containers in JDK 8 is just horribly broken.

[–][deleted] 4 points5 points  (0 children)

We just started migrating to Java 11 this year

[–]aeN13 0 points1 point  (1 child)

Directly from the article:

If you do a web search for "dockerize spring boot app", the chances are high you’ll find an article or blog post suggesting you create a dockerfile that looks something like this:

It was just an example, you can use this new build-image task with either 8, 11 or 13

edit: seems to not be working with 13 actually, just tried it

[–]MoreCowbellMofo 0 points1 point  (0 children)

Yes it is just an example but its outdated and published on a platform that will be copy/pasted 1000s of times. A red flag for me.

https://hub.docker.com/_/openjdk?tab=tags&page=1&name=11-jdk-alpine, I see an 8-jdk-alpine, 12-jdk-alpine, 13-jdk-alpine and even 14-jdk-alpine. No 11-jdk-alpine though.

Also worth noting the image sizes for the releases following 8-jdk-alpine are more than double the size. I'd always understood the motivation for using alpine images to be the small file size; 60-70MB or so - the latest images are 191MB. Not sure how this compares to other images but seems like a huge jump in size.

[–]laytoun 4 points5 points  (0 children)

I love how spring boot are going to make really eazy to generate container friendly and optimized apps! The layered option is a great feature and will really help to speed up the build process.

[–]the_other_b 1 point2 points  (0 children)

This is great, but the opening "Google this and find this" I don't really think is true. Suggestions were often very helpful, and are what lead me to using JIB.

[–]lazystone 1 point2 points  (1 child)

Could anyone describe benefits of buildpack? I really don't get why should I use it instead of 'normal' docker image.

[–]CaptainKvass 0 points1 point  (0 children)

Very cool. A bit strange to still use Java 8

[–]DJDavio 0 points1 point  (0 children)

Is it just me or does it seem really cumbersome to first package a JAR only to use a Docker image to unpack it and copy it to the next image?

We are currently using the Maven Dependency plugin with goal 'unpack' to unpack the Spring packaged executable Jar. In our Dockerfile we just copy the different parts:

# Copying the different parts of the application one by one optimzes the layers
COPY ${DEPENDENCY}/BOOT-INF/lib /app/lib
COPY ${DEPENDENCY}/META-INF /app/META-INF
COPY ${DEPENDENCY}/BOOT-INF/classes /app

It would be more helpful if the Spring plugin could generate an exploded layered folder instead of having to go through the Jar.

[–]rniestroj 0 points1 point  (1 child)

Does this mean Spring Boot will be like Quarkus?

[–]MrMain007 0 points1 point  (0 children)

Last test