80 lines
2.1 KiB
Docker
80 lines
2.1 KiB
Docker
ARG IMAGE_VERSION
|
|
FROM docker.io/rockdrilla/graalvm-debian:base-${IMAGE_VERSION} AS base
|
|
|
|
## ---
|
|
|
|
FROM base as jdk-fetch
|
|
SHELL [ "/bin/sh", "-ec" ]
|
|
|
|
COPY /scripts/* /usr/local/sbin/
|
|
|
|
# ARG JAVA_VERSION_MAJOR
|
|
# ARG GRAALVM_BASE_FILE="graalvm-jdk-${JAVA_VERSION_MAJOR}_linux-x64_bin.tar.gz"
|
|
# ARG GRAALVM_BASE_URI="https://download.oracle.com/graalvm/${JAVA_VERSION_MAJOR}/latest"
|
|
# ARG GRAALVM_URI="${GRAALVM_BASE_URI}/${GRAALVM_BASE_FILE}"
|
|
# ADD "${GRAALVM_URI}" /tmp/graalvm.tar.gz
|
|
|
|
ARG GRAALVM_BASE_FILE
|
|
COPY "/artifact-cache/${GRAALVM_BASE_FILE}" /tmp/graalvm.tar.gz
|
|
|
|
ARG PSL_URI='https://publicsuffix.org/list/public_suffix_list.dat'
|
|
ADD "${PSL_URI}" /tmp/public_suffix_list.dat
|
|
|
|
WORKDIR /opt/graalvm
|
|
|
|
RUN tar --strip-components=1 -xf /tmp/graalvm.tar.gz ; \
|
|
rm -rf \
|
|
GRAALVM-README.md \
|
|
license-information-user-manual.zip \
|
|
lib/security/cacerts \
|
|
lib/security/krb5.conf \
|
|
; \
|
|
cp -f /tmp/public_suffix_list.dat lib/security/ ; \
|
|
ln -sv /etc/ssl/certs/java/cacerts lib/security/ ; \
|
|
ln -sv /etc/krb5.conf lib/security/ ; \
|
|
find "${PWD}/" -name '*.so' -exec dirname '{}' '+' \
|
|
| sort -uV > ld.so.conf ; \
|
|
chmod -R go-w "${PWD}/"
|
|
|
|
## https://github.com/docker-library/openjdk/issues/212#issuecomment-420979840
|
|
## https://openjdk.java.net/jeps/341
|
|
ENV PATH="/opt/graalvm/bin:${PATH}" \
|
|
JAVA_HOME=/opt/graalvm
|
|
RUN ln -s "${PWD}/ld.so.conf" /etc/ld.so.conf.d/graalvm.conf ; \
|
|
ldconfig ; \
|
|
java -Xshare:dump
|
|
|
|
RUN find /tmp/ -mindepth 1 -ls -delete
|
|
|
|
## deduplicate (!)
|
|
RUN apt-install.sh jdupes ; \
|
|
apt-clean.sh ; \
|
|
echo ; \
|
|
du -xd1 "${PWD}/" | sort -Vk2 ; \
|
|
echo ; \
|
|
jdupes -1LSpr "${PWD}/" ; \
|
|
echo ; \
|
|
du -xd1 "${PWD}/" | sort -Vk2 ; \
|
|
echo
|
|
|
|
## ---
|
|
|
|
FROM base AS jdk
|
|
SHELL [ "/bin/sh", "-ec" ]
|
|
|
|
COPY /Dockerfile.jdk /usr/local/share/
|
|
|
|
ENV JAVA_HOME=/opt/graalvm
|
|
|
|
COPY --from=jdk-fetch "${JAVA_HOME}/" "${JAVA_HOME}/"
|
|
|
|
RUN ln -s "${JAVA_HOME}/ld.so.conf" /etc/ld.so.conf.d/graalvm.conf ; \
|
|
ldconfig
|
|
|
|
ENV PATH="${JAVA_HOME}/bin:${PATH}" \
|
|
MALLOC_ARENA_MAX=4
|
|
|
|
## qa/smoke
|
|
RUN set -xv ; java -version ; \
|
|
find /tmp/ -mindepth 1 -ls -delete
|