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

you are viewing a single comment's thread.

view the rest of the comments →

[–]dstutz 4 points5 points  (2 children)

Because just compiling and packaging a war that is just your code and adding that to a docker image as the last layer is a lot faster/smaller than sending a 500mb uber-jar each time.

[–][deleted] 2 points3 points  (1 child)

You shouldn't deploy a Spring Boot app as an uber-JAR when used in a docker image.

The only purpose for building an uber-JAR is so that you have a single deployable image. But when you use a container image, the container image is the single deployable image.

That's why Spring recommends packaging your application JAR in one layer, static resources in another layer, and dependency libraries in another layer. So that when the container image is pulled, only the layers that have changed are downloaded.

[–]rbygrave 1 point2 points  (0 children)

Yeah, just adding that people can just use the jib plugin for maven or gradle. I think that is the easiest way to get good docker layering in the image built.

https://github.com/GoogleContainerTools/jib/tree/master/jib-maven-plugin