question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add architecture option for spring-boot-maven-plugin when using buildpacks

See original GitHub issue

First 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:closed
  • Created 9 months ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
scottfrederickcommented, Dec 9, 2022

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.

0reactions
klopfdrehcommented, Dec 9, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring Boot Maven Plugin Documentation
It allows you to package executable jar or war archives, run Spring Boot applications, generate build information and start your Spring Boot ......
Read more >
Getting Started Deploying Spring Apps | Cloud Foundry Docs
This guide is intended to walk you through deploying a Spring app to Cloud Foundry. You can choose whether to push a sample...
Read more >
Go Native with Spring Boot and GraalVM - InfoQ
Hit cmd + B or Ctrl + B or click on Add Dependencies and select Spring Native. The Spring Initializr configures Apache Maven...
Read more >
Tips for Java Developers | Pivotal Docs
See Configure HTTP/2 in the Spring Boot documentation. ... configure the Java buildpack using the native setting of the memory calculator, ...
Read more >
Buildpacks | Heroku Dev Center
You can change the buildpack used by an application by setting the buildpack value. When the application is next pushed, the new buildpack...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found