Add support for building OCI images using the Gradle plugin

Closes gh-19831
This commit is contained in:
Andy Wilkinson
2020-01-22 14:54:32 +00:00
parent bc452bc094
commit 0bd0b2a6c0
12 changed files with 533 additions and 8 deletions

View File

@@ -26,6 +26,7 @@ Andy Wilkinson
:api-documentation: {spring-boot-docs}/gradle-plugin/api
:spring-boot-reference: {spring-boot-docs}/reference/htmlsingle
:build-info-javadoc: {api-documentation}/org/springframework/boot/gradle/tasks/buildinfo/BuildInfo.html
:boot-build-image-javadoc: {api-documentation}/org/springframework/boot/gradle/tasks/bundling/BootBuildImage.html
:boot-jar-javadoc: {api-documentation}/org/springframework/boot/gradle/tasks/bundling/BootJar.html
:boot-war-javadoc: {api-documentation}/org/springframework/boot/gradle/tasks/bundling/BootWar.html
:boot-run-javadoc: {api-documentation}/org/springframework/boot/gradle/tasks/run/BootRun.html

View File

@@ -298,3 +298,12 @@ The jar will then be split into layer folders which may include:
* `resources`
* `snapshots-dependencies`
* `dependencies`
[[packaging-oci-images]]
== Packaging OCI images
The plugin can create OCI images from executable jars using a https://buildpacks.io[buildpack].
Images can be built using the `bootBuildImage` task and a local Docker installation.
The task is automatically created when the `java` plugin is applied and is an instance of {boot-build-image-javadoc}[`BootBuildImage`].

View File

@@ -15,10 +15,11 @@ When Gradle's {java-plugin}[`java` plugin] is applied to a project, the Spring B
The jar will contain everything on the runtime classpath of the main source set; classes are packaged in `BOOT-INF/classes` and jars are packaged in `BOOT-INF/lib`
2. Configures the `assemble` task to depend on the `bootJar` task.
3. Disables the `jar` task.
4. Creates a {boot-run-javadoc}[`BootRun`] task named `bootRun` that can be used to run your application.
5. Creates a configuration named `bootArchives` that contains the artifact produced by the `bootJar` task.
6. Configures any `JavaCompile` tasks with no configured encoding to use `UTF-8`.
7. Configures any `JavaCompile` tasks to use the `-parameters` compiler argument.
4. Creates a {boot-build-image-javadoc}[`BootBuildImage`] task named `bootBuildImage` that will create a OCI image using a https://buildpacks.io[buildpack].
5. Creates a {boot-run-javadoc}[`BootRun`] task named `bootRun` that can be used to run your application.
6. Creates a configuration named `bootArchives` that contains the artifact produced by the `bootJar` task.
7. Configures any `JavaCompile` tasks with no configured encoding to use `UTF-8`.
8. Configures any `JavaCompile` tasks to use the `-parameters` compiler argument.