From 3a2f4da12293b41f19cce23c827312074f907ffb Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 26 Nov 2022 11:10:37 +0100 Subject: [PATCH] Ensure JAVA_HOME is properly defined MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .xmake.cfg | 2 +- Dockerfile | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) 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 -- 2.34.1