build-image
build-image copied to clipboard
Customizable Java version
Is your feature request related to a problem? Please describe.
Some build tools require a particular version of Java (e.g., Google Closure Compiler). The current version of the build-image requires Java 8 and does not appear customizable. The Google Closure Compiler, for example, requires Java 11, and is therefore incompatible with Netlify (builds will fail due to the mismatched version).
Describe the solution you'd like
Add the ability to specify the Java version required in a manner similar to how it does so for other tools described here.
Describe alternatives you've considered
- Install Java every time the CI runs. This is a time consuming operation that would greatly increase our total build times.
- As suggested by a Netlify support engineer, we could include the Java version we want to use in our actual code repository, shelling out to that executable instead. This may work (?), but would bloat our repository size until the end of time.
Additional context
- Forum post: Java 11 support?
- Netlify Support Ticket: 97043
Can you submit a pull request?
Not at this time.
I found this issue when I realized my ClojureScript builds with Shadow-Cljs were failing.
The easiest temporary workaround for me was to downgrade shadow-cljs to version 2.19.6. Version 2.19.7 introduces the dependency to Java 11+ (indirectly through a newer version of the Google Closure Compiler).
I've looked further into this issue, because I wanted to see how hard it would be to create a PR.
DISCLAIMER: I am not Docker or Java or Linux expert, so read the following with that in mind.
According to http://packages.ubuntu.com the Debian (amd64) packages will take up the following space once installed:
- openjdk-8-jdk-headless 39Mb
- openjdk-11-jdk-headless 228 Mb
- openjdk-17-jdk-headless 246 Mb
Currently, the Docker "build image" takes up 2.12GB (just built it locally). In my book, that would mean that for every Java version extra installed, the build image size would increase with at least 10%.
It seems all the Java packages contain the following zip file, with the source code for the Java release
It takes up a considerable amount of space on the disk (around 50Mb):
/usr/lib/jvm/java-11-openjdk-amd64/lib/src.zip
Dunno, how important that file is.
Trade offs, trade offs :shrug: