just updated my applications to spring boot 2.3.0 and wanted to try the new gradle task to build the image. Unfortunately it seems to be incompatible with executable jars.
In build.gradle I have:
bootJar {
archiveBaseName = 'cat'
group project.group
launchScript {
properties mode: 'service'
}
}
If I try to build the image with this I will have an error:
[creator] ERROR: No buildpack groups passed detection.
If I remove the launchScript section it works.
Comment From: wilkinsona
I don't think the code in the buildpack that processes the archive understands a zip file with the launch script prepended to it. This is mentioned (although not specifically for buildpacks) in the documentation.
@fer-marino When you build a container image using Spring Boot's buildpack support, the buildpack will configure the container's entry point to launch the application and it won't make any use of the launch script. What was your end goal when trying to build an image from a jar that also has the launch script prepended?
Comment From: spring-projects-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: fer-marino
My use case is the usual of start up script: check and setup the environment. My application are all very old and we are slowly porting them to spring boot and container. Some even have native code that requires some misterious magic in the startup script to make it work.
Il mar 2 giu 2020, 16:09 Spring Issuemaster notifications@github.com ha scritto:
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/spring-projects/spring-boot/issues/21539#issuecomment-637567850, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOIYA6QUJQ3OYYRO6ADHDLRUUBZHANCNFSM4NHUFPXA .
Comment From: wilkinsona
Thanks for the additional background. Given your requirement to use the launch script, you'll either need to use a custom builder or use your own Dockerfile to create the container. The latter is probably the easier of the two to get started.
Comment From: Raniz85
To workaround this you can write your own task that takes the boot JAR as input, copies it to another JAR and removes everything up to the ZIP magic number (which always starts a JAR archive).
You can then change the archive file that bootBuildImage uses as source and it'll work.