Using spring-boot build-image with custom buildpack and bindings

43 views Asked by At

I am trying to build a docker image out of my spring boot application using the build-image command from spring boot:s maven plugin.

I am trying to use it with the azure-application-insights buildpack, without success so far.

Below is my configuration:

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
        <image>
            <builder>paketobuildpacks/builder-jammy-base:latest</builder>
            <buildpacks>gcr.io/paketo-buildpacks/java,gcr.io/paketo-buildpacks/azure-application-insights</buildpacks>
            <bindings>${basedir}/insights:/insights,volume-opt=type=ApplicationInsights</bindings>
        </image>
    </configuration>
</plugin>

I have a multi-module maven setup, so I am running the command like so:

  1. mvn -T 4 install --projects :my-service --also-make --batch-mode
  2. mvn spring-boot:build-image -Dspring-boot.build-image.imageName=<image-name> --projects :my-service -DskipTests

I am getting this error:

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:3.2.3:build-image (default-cli) on project my-service: Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:3.2.3:build-image failed: Docker API call to '/var/run/docker.sock/v1.24/containers/create' failed with status code 500 "Internal Server Error"

I have been experimenting with the volume-opt option, and I can't seem to get it right after trying multiple ways of specifying it.

I have also tried:

<bindings>${basedir}/insights:/insights[:volume-opt=type=ApplicationInsights]</bindings>
<bindings>${basedir}/insights:/insights[volume-opt=type=ApplicationInsights]</bindings>
<bindings>${basedir}/insights:/insights,"volume-opt=type=ApplicationInsights]</bindings>"

I have also tried adding a type file in my insights folder where the content is ApplicationInsights. Not working.

If I remove the bindings option the build works, but the azure-application-insights buildpack is not used.

Any help appreciated.

0

There are 0 answers