Skip to content

Commit f4d83f5

Browse files
committed
Commit from GitHub Actions (Reduce README)
1 parent f260689 commit f4d83f5

File tree

1 file changed

+72
-2
lines changed

1 file changed

+72
-2
lines changed

README-reduced.adoc

+72-2
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,74 @@ This test automatically runs when you run the `./gradlew clean build` task.
124124

125125
// required: {build_system} maven|gradle, {build_name}, {build_version}
126126
// optional: {network_container}, {custom_hint_include_file}
127-
link:https://raw.githubusercontent.com/spring-guides/getting-started-macros/main/build_and_execute_guide.adoc[role=include]
127+
// required variables:
128+
// build_system - maven or gradle
129+
// build_name
130+
// build_version
131+
132+
// optional variables:
133+
// network_container - if the generated Docker container needs to run on the same network as an external dependency, this is the name of that container dependency
134+
// custom_hint_include_file - if the native compilation section needs additional description in the form of a custom hint, this is the file that should be rendered as additional content
135+
136+
137+
// jar
138+
:jar_build_command: ./gradlew clean build
139+
:jar_run_command: java -jar build/libs/{build_name}-{build_version}.jar
140+
141+
// docker container
142+
:image_build_command: ./gradlew bootBuildImage
143+
:image_run_command: docker run docker.io/library/{build_name}:{build_version}
144+
145+
// native
146+
:native_build_command: ./gradlew nativeCompile
147+
:native_run_command: build/native/nativeCompile/{build_name}
148+
149+
// native docker container
150+
:native_image_build_command: ./gradlew bootBuildImage
151+
:native_image_run_command: docker run docker.io/library/{build_name}:{build_version}
152+
153+
154+
155+
== Building the Application
156+
157+
In this section, we will describe four different ways to run this guide:
158+
159+
1. https://docs.spring.io/spring-boot/docs/current/reference/html/using.html#using.build-systems[Building and executing a JAR file]
160+
2. https://docs.spring.io/spring-boot/docs/current/reference/html/container-images.html#container-images.buildpacks[Building and executing a Docker container, using Cloud Native Buildpacks^]
161+
3. https://docs.spring.io/spring-boot/docs/current/reference/html/native-image.html#native-image.developing-your-first-application.native-build-tools[Building and executing a native image^]
162+
4. https://docs.spring.io/spring-boot/docs/current/reference/html/native-image.html#native-image.developing-your-first-application.buildpacks[Building and executing a native image container, using Cloud Native Buildpacks^]
163+
164+
Regardless of how you choose to execute the application, the output should be the same.
165+
166+
To run the application, you can package the application as an executable jar.
167+
The command `{jar_build_command}` will compile the application to an executable jar.
168+
You can then run the jar with the command `{jar_run_command}`
169+
170+
Alternatively, if you have a Docker environment available, you could create a Docker image directly from your Maven or Gradle plugin, using buildpacks.
171+
With https://docs.spring.io/spring-boot/docs/current/reference/html/container-images.html#container-images.buildpacks[Cloud Native Buildpacks^], you can create Docker compatible images that you can run anywhere.
172+
Spring Boot includes buildpack support directly for both Maven and Gradle.
173+
This means you can type a single command and quickly get a sensible image into a locally running Docker daemon.
174+
To create a Docker image using Cloud Native Buildpacks, run the command `{image_build_command}`.
175+
With a Docker environment enabled, you can execute the application with the command `{image_run_command}`
176+
177+
178+
=== Native Image Support
179+
180+
Spring Boot also supports https://docs.spring.io/spring-boot/docs/current/reference/html/native-image.html#native-image.introducing-graalvm-native-images[compilation to a native image^], provided you have a GraalVM distribution on your machine.
181+
To create a https://docs.spring.io/spring-boot/docs/current/reference/html/native-image.html#native-image.developing-your-first-application.native-build-tools.gradle[native image with Gradle^] using Native Build Tools, first make sure that your Gradle build contains a `plugins` block that includes `org.graalvm.buildtools.native`.
182+
----
183+
plugins {
184+
id 'org.graalvm.buildtools.native' version '0.9.28'
185+
...
186+
----
187+
188+
189+
You can run the command `{native_build_command}` to generate a native image. When the build completes, you will be able to run the code with a near instantaneous start up time by executing the command `{native_run_command}`.
190+
191+
192+
You can also create a https://docs.spring.io/spring-boot/docs/current/reference/html/native-image.html#native-image.developing-your-first-application.buildpacks[Native Image using Buildpacks^]. You can generate a native image by running the command `{native_image_build_command}`. Once the build completes, you can start your application with the command `{native_image_run_command}`
193+
194+
128195

129196
== Summary
130197

@@ -137,4 +204,7 @@ The following guides may also be helpful:
137204
* https://spring.io/guides/gs/spring-boot/[Building an Application with Spring Boot^]
138205
* https://spring.io/guides/gs/batch-processing/[Creating a Batch Service^]
139206

140-
link:https://raw.githubusercontent.com/spring-guides/getting-started-macros/main/footer.adoc[role=include]
207+
208+
Want to write a new guide or contribute to an existing one? Check out our https://github.com/spring-guides/getting-started-guides/wiki[contribution guidelines].
209+
210+
IMPORTANT: All guides are released with an ASLv2 license for the code, and an http://creativecommons.org/licenses/by-nd/3.0/[Attribution, NoDerivatives creative commons license] for the writing.

0 commit comments

Comments
 (0)