Last active
January 3, 2021 13:03
-
-
Save rhuss/6d3c0c687fb4ec39c3e4 to your computer and use it in GitHub Desktop.
The Holy Grail of a Minimal, Headless, OpenJDK JRE 8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Build for 206 MB JRE 1.8.0_60 (192 MB in size) with Alping and glibc | |
FROM alpine:3.2 | |
ENV JRE=jre1.8.0_60 \ | |
JAVA_HOME=/opt/jre | |
# That's the an EA from OpenJDK.net | |
# Courtesy to https://github.com/frol/docker-alpine-oraclejdk8 from where the setup of glibc is borrowed | |
RUN apk add --update wget ca-certificates && \ | |
cd /tmp && \ | |
wget "https://circle-artifacts.com/gh/andyshinn/alpine-pkg-glibc/6/artifacts/0/home/ubuntu/alpine-pkg-glibc/packages/x86_64/glibc-2.21-r2.apk" \ | |
"https://circle-artifacts.com/gh/andyshinn/alpine-pkg-glibc/6/artifacts/0/home/ubuntu/alpine-pkg-glibc/packages/x86_64/glibc-bin-2.21-r2.apk" && \ | |
apk add --allow-untrusted glibc-2.21-r2.apk glibc-bin-2.21-r2.apk && \ | |
/usr/glibc/usr/bin/ldconfig /lib /usr/glibc/usr/lib && \ | |
echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf && \ | |
mkdir /opt && \ | |
wget http://www.java.net/download/jdk8u60/archive/b18/binaries/jre-8u60-ea-bin-b18-linux-x64-02_jun_2015.tar.gz -O /tmp/${JRE}.tgz && \ | |
cd /opt && tar zxvf /tmp/${JRE}.tgz && \ | |
ln -s /opt/${JRE} /opt/jre && \ | |
ln -s /opt/jre/bin/java /usr/bin/java && \ | |
apk del wget ca-certificates && \ | |
cd /opt/jre/lib/amd64 && rm libjavafx_* libjfx* libfx* && \ | |
cd /opt/jre/lib/ && rm -rf ext/jfxrt.jar jfxswt.jar javafx.properties font* && \ | |
rm /tmp/* /var/cache/apk/* |
Added it to rhuss/docker-java-jolokia
Is there an ARMV6 or ARMV7 of glibc for alpine?
So I'm going to go do some research but maybe someone here knows already?
There seems to be already maintained openjdk packages in the apk repos: https://pkgs.alpinelinux.org/package/community/x86_64/openjdk8
And it requires musl instead of a glibc package -- is it documented anywhere that openjdk and/or oracle jdk require glibc? or one requires one vs the other?
Oracle JDK is not working with musl, see this issue.
Alpine's OpenJDK build seems to be fine with musl (and w/o glibc), I'm running a artifactory instance with it.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A further optimization of the official build is to avoid the initial
ADD
and do a direct download, extraction, removal in one singleRUN
step to avoid the large layer added qithADD
Also removing JavaFX helps quite a bit.
Image size is now down to 127 MB