Skip to content

Commit

Permalink
Set JAVA_HOME manually for amazoncorretto-debian images (#454)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
anirbanmu and carlossg authored Apr 1, 2024
1 parent 551204c commit 5c5d19e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
4 changes: 3 additions & 1 deletion amazoncorretto-11-debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ 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 \
&& apt-get remove --purge --autoremove -y curl gnupg \
&& 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

Expand Down
4 changes: 3 additions & 1 deletion amazoncorretto-17-debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ 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 \
&& apt-get remove --purge --autoremove -y curl gnupg \
&& 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

Expand Down
4 changes: 3 additions & 1 deletion amazoncorretto-21-debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ 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 \
&& apt-get remove --purge --autoremove -y curl gnupg \
&& 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

Expand Down
4 changes: 3 additions & 1 deletion amazoncorretto-8-debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ 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 \
&& apt-get remove --purge --autoremove -y curl gnupg \
&& 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

Expand Down

0 comments on commit 5c5d19e

Please sign in to comment.