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 ;; \
&& 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