I have a Dockerfile that ends with:
ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"]
Now I want to run some initialisation from a shell script before that. So I have to refactor that to:
ENTRYPOINT[ /entrypoint.sh]
With:
!#/bin/bash
echo "some init"
#TODO
#ENTRYOINT["java", "org.springframework.boot.loader.JarLauncher"]
Question: how can I actually simulate the java entrypoint inside the shell script?
>Solution :
ShellScript can be edited to run normal Java file.
From docker documentation:
If you need to write a starter script for a single executable, you can ensure that the final executable receives the Unix signals by using exec
!#/bin/bash
echo "some init"
#Execute using linux 'exec' Java launcher
exec java org.springframework.boot.loader.JarLauncher