openjdk-docker
openjdk-docker copied to clipboard
Missing jjs engine in Alpine slim image.
I'm building a Docker image for Mule 4 using jdk8u232-b09-alpine-slim. However, Mule is failing when deploying Applications in the Mule container. I found out that Mule is using jjs command to process the configuration files from the $MULE_HOME/conf folder but jjs was removed in the slim version of Alpine.
Particularly, by copying back these files to the image, I was able to solve the issue:
- /opt/java/openjdk/jre/bin/jjs
- /opt/java/openjdk/jre/lib/ext/nashorn.jar
- /opt/java/openjdk/jre/lib/amd64/jli/libjli.so
The solution that worked for me was building the Docker image using multi-stage build to copy the missing files from the non-slim Docker image as shown below:
FROM adoptopenjdk/openjdk8:jdk8u232-b09-alpine AS javabuild
FROM adoptopenjdk/openjdk8:jdk8u232-b09-alpine-slim
# Fix OpenJDK missing jjs engine needed by Mule
COPY --from=javabuild /opt/java/openjdk/jre/bin/jjs /opt/java/openjdk/jre/bin/
COPY --from=javabuild /opt/java/openjdk/jre/lib/ext/nashorn.jar /opt/java/openjdk/jre/lib/ext/nashorn.jar
COPY --from=javabuild /opt/java/openjdk/jre/lib/amd64/jli/libjli.so /opt/java/openjdk/jre/lib/amd64/jli/
So, the question is if these files can be kept in the openjdk-slim image instead to fulfill Mule dependency.
Depending on the line which we would like to have to distinguish slim/not-slim boundaries. Not sure how to proceed for now. Would be good to discuss and have guidelines about what we consider a slim version.
After giving some thought, IMO, the line should be around what is needed to have a Working Production environment with a slim image. In this case, I can safely remove any Development tool, source code, documentation, manual pages, and even Management and Instrumentation tools, etc.
Now, for this specific case, the question is what would be bringing more value. Stripping the JavaScript engine to save ~2Mb in the image or on the other hand, bringing it back and support any application that requires a JS engine but with a final slim image 2M bigger?
From my side, I dug into Mule dependency with jjs, and it seems is used by DataWeave library but also by the Groovy-all library (Used by Mule launcher) that is more generic and not specific to Mule.
@dinogun any thought here ?
Any news about this issue? I am having the same problem.