Add architecture option for spring-boot-maven-plugin when using buildpacks
See original GitHub issueFirst of all thanks a lot for the great way to compile native applications with Spring Boot 3!
I just created a ticket https://github.com/paketo-buildpacks/base-builder/issues/652 to support arm64 arch builder maintained by paketo.
So my suggestion would be for the spring-boot-maven-plugin that it somehow detects the arch at which the plugin is executed and hands this over to each docker pull. (see description of the linked ticket). This option should be configurable so that there is the chance to override it. (e.g. arch or something like that).
This configuration should be available for all tags like builder / runImage / buildpacks.
New example configuration:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<builder>
<arch>linux/arm64</arch>
<from>paketobuildpacks/builder:tiny</from>
</builder>
<runImage>
<arch>linux/arm64</arch>
<from>paketobuildpacks/run:latest</from>
</runImage>
<env>
<BP_NATIVE_IMAGE>true</BP_NATIVE_IMAGE>
</env>
<buildpacks>
<buildpack>
<arch>linux/arm64</arch>
<from>gcr.io/paketo-buildpacks/java-native-image:7.8.1</from>
</buildpack>
</buildpacks>
</image>
</configuration>
</plugin>
This way you can either let the spring-boot-maven-plugin detect the arch, or choose a different arch for each image.
WDYT?
See also: https://github.com/paketo-buildpacks/stacks/issues/51#issuecomment-1024982024
Issue Analytics
- State:
- Created 9 months ago
- Comments:5 (3 by maintainers)
The Spring Boot plugins make a Docker Engine API call to the local Docker daemon. without providing a
platform
option, so it’s really up to the daemon. The Docker daemon does appear to pull the image matching the platform that it is running on.I tested that using a multi-arch CNB builder derived from the Paketo builder available here (more information on that here). When I configured my Spring Boot build to use that builder, the version for my architecture was pulled.
I also used this to validate my assumptions on the effects of using a builder for the wrong architecture. If you
docker pull [builder image] --platform [wrong arch for your local machine]
, specify that builder image in your build file, and also specify<pullPolicy>NEVER</pullPolicy>
in your bulid file, then you’re likely to have a bad experience when building the image.Hey @scottfrederick - I just have one last question. As you can see I linked an issue at paketo builders. Does the spring-boot-maven-plugin always pull the right builder image if two platforms are available? If yes I agree to add an option which could cause issues would not be a good option.