I'm running a Micronaut application as a Docker container.
At runtime in Kuberentes there will be a JAVA_OPTS environment variable with certaint values, e.g.: -XX:MaxRAMPercentage=45.0
When executing ./gradlew dockerBuild
I can see the following Docker layer:
Step 7/7 : ENTRYPOINT ["java", "-jar", "/home/app/application.jar"]
Following the documentation I tried to add a reference to JAVA_OPTS:
build.gradle.kts
dockerfile {
args("\$JAVA_OPTS")
}
Docker build log:
Step 7/7 : ENTRYPOINT ["java", "$JAVA_OPTS", "-jar", "/home/app/application.jar"]
The problem with this, is that the container wont's start, since $JAVA_OPTS won't be replaced by the env variable value. This happens because it is using the exec form of the ENTRYPOINT.
Is there a way to override or tune the ENTRYPOINT so that env vars are evaluated?