From: Jérôme Benoit Date: Sat, 26 Nov 2022 10:10:37 +0000 (+0100) Subject: Ensure JAVA_HOME is properly defined X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=3a2f4da12293b41f19cce23c827312074f907ffb;p=mbt-docker.git Ensure JAVA_HOME is properly defined Signed-off-by: Jérôme Benoit --- diff --git a/.xmake.cfg b/.xmake.cfg index e6c9cd4..ee598d0 100644 --- a/.xmake.cfg +++ b/.xmake.cfg @@ -1,5 +1,5 @@ [xmake] -version=1.0.9 +version=1.0.10 # https://github.wdf.sap.corp/pages/xmake-ci/User-Guide/Setting_up_a_Build/Release_Procedure/Release_Versions/ [buildplugin] diff --git a/Dockerfile b/Dockerfile index dcb4c74..3942c2d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -113,7 +113,10 @@ RUN set -ex \ ARG SAPMACHINE_VERSION=11.0.17 -RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \ +ENV JAVA_HOME /opt/jdk + +RUN ARCH=; SAPMACHINE_MAJOR_VERSION=$(echo ${SAPMACHINE_VERSION} | cut -d. -f1) \ + && dpkgArch="$(dpkg --print-architecture)" \ && case "${dpkgArch##*-}" in \ amd64) ARCH='amd64';; \ *) echo "unsupported architecture"; exit 1 ;; \ @@ -132,9 +135,10 @@ RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \ && chmod 644 /etc/apt/trusted.gpg.d/sapmachine.gpg \ && echo "deb http://dist.sapmachine.io/debian/${ARCH}/ ./" | tee /etc/apt/sources.list.d/sapmachine.list \ && apt-get update \ - && apt-get install -y sapmachine-$(echo ${SAPMACHINE_VERSION} | cut -d. -f1)-jdk=${SAPMACHINE_VERSION} --no-install-recommends \ + && apt-get install -y sapmachine-${SAPMACHINE_MAJOR_VERSION}-jdk=${SAPMACHINE_VERSION} --no-install-recommends \ && rm -rf "$GNUPGHOME" /var/lib/apt/lists/* \ && apt-get remove --purge --autoremove -y ca-certificates gnupg dirmngr \ + && ln -s /usr/lib/jvm/sapmachine-${SAPMACHINE_MAJOR_VERSION} ${JAVA_HOME} \ # smoke test && java -version