Add imagePlatform option for image building
An `imagePlatform` option for the Maven and Gradle image-building goal/task can be used to specify the os/architecture of any builder, run, and buildpack images that are pulled during image building. Closes gh-40944
This commit is contained in:
@@ -31,6 +31,7 @@ import org.springframework.boot.buildpack.platform.build.BuildRequest;
|
||||
import org.springframework.boot.buildpack.platform.build.BuildpackReference;
|
||||
import org.springframework.boot.buildpack.platform.build.PullPolicy;
|
||||
import org.springframework.boot.buildpack.platform.docker.type.Binding;
|
||||
import org.springframework.boot.buildpack.platform.docker.type.ImagePlatform;
|
||||
import org.springframework.boot.buildpack.platform.docker.type.ImageReference;
|
||||
import org.springframework.boot.gradle.junit.GradleProjectBuilder;
|
||||
|
||||
@@ -324,4 +325,15 @@ class BootBuildImageTests {
|
||||
"label=role:ROLE");
|
||||
}
|
||||
|
||||
@Test
|
||||
void whenImagePlatformIsNotConfiguredThenRequestHasNoImagePlatform() {
|
||||
assertThat(this.buildImage.createRequest().getImagePlatform()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
void whenImagePlatformIsConfiguredThenRequestHasImagePlatform() {
|
||||
this.buildImage.getImagePlatform().set("linux/arm64/v1");
|
||||
assertThat(this.buildImage.createRequest().getImagePlatform()).isEqualTo(ImagePlatform.of("linux/arm64/v1"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user