From 5c5d19e4fec5d0c8c4870687bdaa377234ef9b1e Mon Sep 17 00:00:00 2001 From: Anirban Mukhopadhyay Date: Mon, 1 Apr 2024 02:00:46 -0700 Subject: [PATCH] Set JAVA_HOME manually for amazoncorretto-debian images (#454) * Set JAVA_HOME manually for amazoncorretto-debian images * Set JAVA_HOME to known package installation path for Corretto Debian images * fix: do not delete GNUPGHOME as it is flaky and fails often In eclipse-temurin-11 it is also no longer deleted --------- Co-authored-by: Carlos Sanchez --- amazoncorretto-11-debian/Dockerfile | 4 +++- amazoncorretto-17-debian/Dockerfile | 4 +++- amazoncorretto-21-debian/Dockerfile | 4 +++- amazoncorretto-8-debian/Dockerfile | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/amazoncorretto-11-debian/Dockerfile b/amazoncorretto-11-debian/Dockerfile index 793bc9bf..53923e0a 100644 --- a/amazoncorretto-11-debian/Dockerfile +++ b/amazoncorretto-11-debian/Dockerfile @@ -8,7 +8,6 @@ RUN apt-get update \ && export GNUPGHOME="$(mktemp -d)" \ && curl -fL https://apt.corretto.aws/corretto.key | gpg --batch --import \ && gpg --batch --export '6DC3636DAE534049C8B94623A122542AB04F24E3' > /usr/share/keyrings/corretto.gpg \ - && rm -r "$GNUPGHOME" \ && unset GNUPGHOME \ && echo "deb [signed-by=/usr/share/keyrings/corretto.gpg] https://apt.corretto.aws stable main" > /etc/apt/sources.list.d/corretto.list \ && apt-get update \ @@ -16,6 +15,9 @@ RUN apt-get update \ && apt-get install -y java-11-amazon-corretto-jdk \ && rm -rf /var/lib/apt/lists/* +# set JAVA_HOME manually since nothing else will set it +ENV JAVA_HOME "/usr/lib/jvm/java-11-amazon-corretto" + # common for all images ENV MAVEN_HOME /usr/share/maven diff --git a/amazoncorretto-17-debian/Dockerfile b/amazoncorretto-17-debian/Dockerfile index 4d9c83cf..7e848035 100644 --- a/amazoncorretto-17-debian/Dockerfile +++ b/amazoncorretto-17-debian/Dockerfile @@ -8,7 +8,6 @@ RUN apt-get update \ && export GNUPGHOME="$(mktemp -d)" \ && curl -fL https://apt.corretto.aws/corretto.key | gpg --batch --import \ && gpg --batch --export '6DC3636DAE534049C8B94623A122542AB04F24E3' > /usr/share/keyrings/corretto.gpg \ - && rm -r "$GNUPGHOME" \ && unset GNUPGHOME \ && echo "deb [signed-by=/usr/share/keyrings/corretto.gpg] https://apt.corretto.aws stable main" > /etc/apt/sources.list.d/corretto.list \ && apt-get update \ @@ -16,6 +15,9 @@ RUN apt-get update \ && apt-get install -y java-17-amazon-corretto-jdk \ && rm -rf /var/lib/apt/lists/* +# set JAVA_HOME manually since nothing else will set it +ENV JAVA_HOME "/usr/lib/jvm/java-17-amazon-corretto" + # common for all images ENV MAVEN_HOME /usr/share/maven diff --git a/amazoncorretto-21-debian/Dockerfile b/amazoncorretto-21-debian/Dockerfile index 7ae12991..d49b20a1 100644 --- a/amazoncorretto-21-debian/Dockerfile +++ b/amazoncorretto-21-debian/Dockerfile @@ -8,7 +8,6 @@ RUN apt-get update \ && export GNUPGHOME="$(mktemp -d)" \ && curl -fL https://apt.corretto.aws/corretto.key | gpg --batch --import \ && gpg --batch --export '6DC3636DAE534049C8B94623A122542AB04F24E3' > /usr/share/keyrings/corretto.gpg \ - && rm -r "$GNUPGHOME" \ && unset GNUPGHOME \ && echo "deb [signed-by=/usr/share/keyrings/corretto.gpg] https://apt.corretto.aws stable main" > /etc/apt/sources.list.d/corretto.list \ && apt-get update \ @@ -16,6 +15,9 @@ RUN apt-get update \ && apt-get install -y java-21-amazon-corretto-jdk \ && rm -rf /var/lib/apt/lists/* +# set JAVA_HOME manually since nothing else will set it +ENV JAVA_HOME "/usr/lib/jvm/java-21-amazon-corretto" + # common for all images ENV MAVEN_HOME /usr/share/maven diff --git a/amazoncorretto-8-debian/Dockerfile b/amazoncorretto-8-debian/Dockerfile index 0aa07682..41cff342 100644 --- a/amazoncorretto-8-debian/Dockerfile +++ b/amazoncorretto-8-debian/Dockerfile @@ -8,7 +8,6 @@ RUN apt-get update \ && export GNUPGHOME="$(mktemp -d)" \ && curl -fL https://apt.corretto.aws/corretto.key | gpg --batch --import \ && gpg --batch --export '6DC3636DAE534049C8B94623A122542AB04F24E3' > /usr/share/keyrings/corretto.gpg \ - && rm -r "$GNUPGHOME" \ && unset GNUPGHOME \ && echo "deb [signed-by=/usr/share/keyrings/corretto.gpg] https://apt.corretto.aws stable main" > /etc/apt/sources.list.d/corretto.list \ && apt-get update \ @@ -16,6 +15,9 @@ RUN apt-get update \ && apt-get install -y java-1.8.0-amazon-corretto-jdk \ && rm -rf /var/lib/apt/lists/* +# set JAVA_HOME manually since nothing else will set it +ENV JAVA_HOME "/usr/lib/jvm/java-1.8.0-amazon-corretto/jre" + # common for all images ENV MAVEN_HOME /usr/share/maven