Use Paketo tiny builder by default for JVM and native apps
Closes gh-40859
This commit is contained in:
		
							parent
							
								
									61ac0e32a1
								
							
						
					
					
						commit
						6d2ebc0713
					
				|  | @ -267,7 +267,6 @@ publishing.publications.withType(MavenPublication) { | |||
| 									delegate.artifactId('spring-boot-maven-plugin') | ||||
| 									configuration { | ||||
| 										image { | ||||
| 											delegate.builder("paketobuildpacks/builder-jammy-tiny:latest"); | ||||
| 											env { | ||||
| 												delegate.BP_NATIVE_IMAGE("true") | ||||
| 											} | ||||
|  |  | |||
|  | @ -45,7 +45,7 @@ import org.springframework.util.Assert; | |||
|  */ | ||||
| public class BuildRequest { | ||||
| 
 | ||||
| 	static final String DEFAULT_BUILDER_IMAGE_NAME = "paketobuildpacks/builder-jammy-base:latest"; | ||||
| 	static final String DEFAULT_BUILDER_IMAGE_NAME = "paketobuildpacks/builder-jammy-tiny:latest"; | ||||
| 
 | ||||
| 	private static final ImageReference DEFAULT_BUILDER = ImageReference.of(DEFAULT_BUILDER_IMAGE_NAME); | ||||
| 
 | ||||
|  |  | |||
|  | @ -119,7 +119,7 @@ The following table summarizes the available properties and their default values | |||
| | `builder` | ||||
| | `--builder` | ||||
| | Name of the Builder image to use. | ||||
| | `paketobuildpacks/builder-jammy-base:latest` or `paketobuildpacks/builder-jammy-tiny:latest` when {url-native-build-tools-docs-gradle-plugin}[GraalVM Native Image plugin] is applied. | ||||
| | `paketobuildpacks/builder-jammy-tiny:latest` | ||||
| 
 | ||||
| | `runImage` | ||||
| | `--runImage` | ||||
|  |  | |||
|  | @ -89,6 +89,6 @@ When the {url-native-build-tools-docs-gradle-plugin}[GraalVM Native Image plugin | |||
| . Configures the GraalVM extension to disable Toolchain detection. | ||||
| . Configures each GraalVM native binary to require GraalVM 22.3 or later. | ||||
| . Configures the `bootJar` task to include the reachability metadata produced by the `collectReachabilityMetadata` task in its jar. | ||||
| . Configures the `bootBuildImage` task to use `paketobuildpacks/builder-jammy-tiny:latest` as its builder and to set `BP_NATIVE_IMAGE` to `true` in its environment. | ||||
| . Configures the `bootBuildImage` task to set `BP_NATIVE_IMAGE` to `true` in its environment. | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -105,10 +105,7 @@ class NativeImagePluginAction implements PluginApplicationAction { | |||
| 	private void configureBootBuildImageToProduceANativeImage(Project project) { | ||||
| 		project.getTasks() | ||||
| 			.named(SpringBootPlugin.BOOT_BUILD_IMAGE_TASK_NAME, BootBuildImage.class) | ||||
| 			.configure((bootBuildImage) -> { | ||||
| 				bootBuildImage.getBuilder().convention("paketobuildpacks/builder-jammy-tiny:latest"); | ||||
| 				bootBuildImage.getEnvironment().put("BP_NATIVE_IMAGE", "true"); | ||||
| 			}); | ||||
| 			.configure((bootBuildImage) -> bootBuildImage.getEnvironment().put("BP_NATIVE_IMAGE", "true")); | ||||
| 	} | ||||
| 
 | ||||
| 	private void configureJarManifestNativeAttribute(Project project) { | ||||
|  |  | |||
|  | @ -92,8 +92,7 @@ class NativeImagePluginActionIntegrationTests { | |||
| 	void bootBuildImageIsConfiguredToBuildANativeImage() { | ||||
| 		writeDummySpringApplicationAotProcessorMainClass(); | ||||
| 		BuildResult result = this.gradleBuild.build("bootBuildImageConfiguration"); | ||||
| 		assertThat(result.getOutput()).contains("paketobuildpacks/builder-jammy-tiny") | ||||
| 			.contains("BP_NATIVE_IMAGE = true"); | ||||
| 		assertThat(result.getOutput()).contains("BP_NATIVE_IMAGE = true"); | ||||
| 	} | ||||
| 
 | ||||
| 	@TestTemplate | ||||
|  |  | |||
|  | @ -173,7 +173,7 @@ class BootBuildImageTests { | |||
| 	@Test | ||||
| 	void whenNoBuilderIsConfiguredThenRequestHasDefaultBuilder() { | ||||
| 		assertThat(this.buildImage.createRequest().getBuilder().getName()) | ||||
| 			.isEqualTo("paketobuildpacks/builder-jammy-base"); | ||||
| 			.isEqualTo("paketobuildpacks/builder-jammy-tiny"); | ||||
| 	} | ||||
| 
 | ||||
| 	@Test | ||||
|  |  | |||
|  | @ -7,7 +7,6 @@ apply plugin: 'org.graalvm.buildtools.native' | |||
| 
 | ||||
| task('bootBuildImageConfiguration') { | ||||
| 	doFirst { | ||||
| 		println "builder = ${tasks.getByName('bootBuildImage').builder.get()}" | ||||
| 		println "BP_NATIVE_IMAGE = ${tasks.getByName('bootBuildImage').environment.get()['BP_NATIVE_IMAGE']}" | ||||
| 	} | ||||
| } | ||||
|  |  | |||
|  | @ -135,7 +135,7 @@ The following table summarizes the available parameters and their default values | |||
| | `builder` + | ||||
| (`spring-boot.build-image.builder`) | ||||
| | Name of the Builder image to use. | ||||
| | `paketobuildpacks/builder-jammy-base:latest` | ||||
| | `paketobuildpacks/builder-jammy-tiny:latest` | ||||
| 
 | ||||
| | `runImage` + | ||||
| (`spring-boot.build-image.runImage`) | ||||
|  |  | |||
|  | @ -69,7 +69,7 @@ class ImageTests { | |||
| 	void getBuildRequestWhenNoCustomizationsUsesDefaults() { | ||||
| 		BuildRequest request = new Image().getBuildRequest(createArtifact(), mockApplicationContent()); | ||||
| 		assertThat(request.getName()).hasToString("docker.io/library/my-app:0.0.1-SNAPSHOT"); | ||||
| 		assertThat(request.getBuilder().toString()).contains("paketobuildpacks/builder-jammy-base"); | ||||
| 		assertThat(request.getBuilder().toString()).contains("paketobuildpacks/builder-jammy-tiny"); | ||||
| 		assertThat(request.getRunImage()).isNull(); | ||||
| 		assertThat(request.getEnv()).isEmpty(); | ||||
| 		assertThat(request.isCleanCache()).isFalse(); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue