From ac69ff88a0d57777bc46a7439e12746c79852c21 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 26 Nov 2022 06:43:57 +0100 Subject: [PATCH] Ensure JAVA_HOME is defined as ENV MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- Dockerfile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5461f15..8db5147 100644 --- a/Dockerfile +++ b/Dockerfile @@ -113,7 +113,10 @@ RUN set -ex \ ARG SAPMACHINE_VERSION=11.0.17 +ENV JAVA_HOME /opt/jdk + RUN sapmachine_install() { \ + SAPMACHINE_MAJOR_VERSION=$(echo ${SAPMACHINE_VERSION} | cut -d. -f1); \ ARCH=; \ dpkgArch="$(dpkg --print-architecture)"; \ case "${dpkgArch##*-}" in \ @@ -133,9 +136,10 @@ RUN sapmachine_install() { \ 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}; \ }; \ sapjvm_install() { \ ARCH=; \ @@ -153,6 +157,7 @@ RUN sapmachine_install() { \ bsdtar -xvf sapjvm-${SAPMACHINE_VERSION}-linux-${ARCH}.zip -C /usr/local --strip-components=1; \ rm -f sapjvm-${SAPMACHINE_VERSION}-linux-${ARCH}.zip; \ apt-get remove --purge --auto-remove -y ca-certificates curl libarchive-tools; \ + ln -s /usr/local ${JAVA_HOME}; \ } \ && set -ex \ && if [ $(echo ${SAPMACHINE_VERSION} | cut -d. -f1) -le 8 ]; then \ -- 2.34.1