akamai / cli-sandbox

Akamai CLI for Sandbox
https://github.com/akamai/cli
Apache License 2.0
13 stars 12 forks source link

Improve Java detection to accept JRE as JDK is not needed #64

Open lukaszczerpak opened 4 years ago

lukaszczerpak commented 4 years ago

JRE is enough for the connector to work properly, but the library "find-java-home" (https://github.com/akamai/cli-sandbox/blob/master/src/utils/env-utils.ts#L4) searches for "javac". If JRE is installed and the file is mocked (touch $JAVA_HOME/bin/javac) then the connector works fine. This would help with size reduction of the docker image we're currently working on.

krzyk commented 3 years ago

@lukaszczerpak Considering that since Java 11 there are no JREs just JDKs is it still valid? Or maybe more appropriate one would be to use jlink to build a minimal JDK to include in the image?

Source: https://www.oracle.com/technetwork/java/javase/11-relnote-issues-5012449.html

In this release, the JRE or Server JRE is no longer offered. Only the JDK is offered. Users can use jlink to create smaller custom runtimes.

lukaszczerpak commented 3 years ago

Good point about JRE @krzyk. I would definitely try to minimise size of the image by using any possible method. Jlink seems to be a perfect fit for this. We currently use openjdk8-jre in the image (https://github.com/akamai/akamai-docker/blob/master/dockerfiles/sandbox.Dockerfile) but this needs to be migrated to newer Java soon. I can play around with this and share results once get it working.