You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc
+4-4
Original file line number
Diff line number
Diff line change
@@ -7966,7 +7966,7 @@ If you need the `Mockk` equivalent of the Mockito specific <<boot-features-testi
7966
7966
7967
7967
7968
7968
[[building-docker-images]]
7969
-
=== Building Docker Images
7969
+
== Building Docker Images
7970
7970
Spring Boot applications can be containerized by packaging them into Docker images.
7971
7971
A typical Spring Boot fat jar can be converted into a Docker image by adding just a few lines to a Dockerfile that can be used to build the image.
7972
7972
However, there are various downsides to copying and running the fat jar as is in the docker image.
@@ -7975,7 +7975,7 @@ The other issue is that putting your application's code and all its dependencies
7975
7975
Since you probably recompile your code more often than you upgrade the version of Spring Boot you use, it’s often better to separate things a bit more.
7976
7976
If you put jar files in the layer before your application classes, Docker often only needs to change the very bottom layer and can pick others up from its cache.
7977
7977
7978
-
==== Layered Jars
7978
+
=== Layered Jars
7979
7979
To make it easier to create optimized Docker images that can be built with a dockerfile, Spring Boot supports "layered jars".
7980
7980
A regular fat jar that can be run with `java -jar` has the following structure:
7981
7981
@@ -8044,7 +8044,7 @@ Application code is more likely to change between builds so it is isolated in a
8044
8044
For Maven, refer to the {spring-boot-maven-plugin-docs}/#repackage-layered-jars[packaging layered jars section] for more details on creating a layered jar.
8045
8045
For Gradle, refer to the {spring-boot-gradle-plugin-docs}/#packaging-layered-jars[packaging layered jars section] of the Gradle plugin documentation.
8046
8046
8047
-
==== Writing the Dockerfile
8047
+
=== Writing the Dockerfile
8048
8048
8049
8049
When you create a layered jar, the `spring-boot-layertools` jar will be added as a dependency to your jar.
8050
8050
With this jar on the classpath, you can launch your application in a special mode which allows the bootstrap code to run something entirely different from your application, for example, something that extracts the layers.
@@ -8097,7 +8097,7 @@ You can use some combination of `unzip` and `mv` to move things to the right lay
8097
8097
8098
8098
8099
8099
8100
-
==== Buildpacks
8100
+
=== Buildpacks
8101
8101
Dockerfiles are just one way to build docker images.
8102
8102
Another way to build docker images is directly from your Maven or Gradle plugin, using buildpacks.
8103
8103
If you’ve ever used an application platform such as Cloud Foundry or Heroku then you’ve probably used a buildpack.
0 commit comments