Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
docker: fix fedora java paths and JAVA_HOME, use alternatives to set …
Browse files Browse the repository at this point in the history
…current java

version
  • Loading branch information
mpranj committed Apr 9, 2021
1 parent 09daa2f commit b5cff96
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
5 changes: 2 additions & 3 deletions scripts/docker/cirrus/fedora/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,5 @@ RUN mkdir -p ${GTEST_ROOT} \
# download and install gradle
RUN cd /tmp && wget https://services.gradle.org/distributions/gradle-6.8.3-bin.zip && unzip gradle-6.8.3-bin.zip && rm gradle-6.8.3-bin.zip && mv gradle-6.8.3 /opt/gradle
ENV PATH "${PATH}:/opt/gradle/bin"
RUN echo "export JAVA_HOME=$(dirname $(dirname $(readlink $(readlink $(which javac)))))" >> /etc/profile.d/java.sh
RUN echo "CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar" >> /etc/profile.d/java.sh
RUN source /etc/profile.d/java.sh
ENV JAVA_HOME=/etc/alternatives/jre
RUN alternatives --auto java && alternatives --auto javac
6 changes: 3 additions & 3 deletions scripts/docker/fedora/31/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ RUN useradd \
# download and install gradle
RUN cd /tmp && wget https://services.gradle.org/distributions/gradle-6.8.3-bin.zip && unzip gradle-6.8.3-bin.zip && rm gradle-6.8.3-bin.zip && mv gradle-6.8.3 /opt/gradle
ENV PATH "${PATH}:/opt/gradle/bin"
RUN echo "export JAVA_HOME=$(dirname $(dirname $(readlink $(readlink $(which javac)))))" >> /etc/profile.d/java.sh
RUN echo "CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar" >> /etc/profile.d/java.sh
RUN source /etc/profile.d/java.sh
ENV JAVA_HOME=/etc/alternatives/jre
# Pipe in 1 as Java 11 is first in the list
RUN echo 1 | alternatives --config java && alternatives --auto javac

USER ${JENKINS_USERID}

Expand Down
6 changes: 3 additions & 3 deletions scripts/docker/fedora/32/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ RUN useradd \
# download and install gradle
RUN cd /tmp && wget https://services.gradle.org/distributions/gradle-6.8.3-bin.zip && unzip gradle-6.8.3-bin.zip && rm gradle-6.8.3-bin.zip && mv gradle-6.8.3 /opt/gradle
ENV PATH "${PATH}:/opt/gradle/bin"
RUN echo "export JAVA_HOME=$(dirname $(dirname $(readlink $(readlink $(which javac)))))" >> /etc/profile.d/java.sh
RUN echo "CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar" >> /etc/profile.d/java.sh
RUN source /etc/profile.d/java.sh
ENV JAVA_HOME=/etc/alternatives/jre
# Pipe in 1 as Java 11 is first in the list
RUN echo 1 | alternatives --config java && alternatives --auto javac

USER ${JENKINS_USERID}

Expand Down
5 changes: 2 additions & 3 deletions scripts/docker/fedora/33/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,8 @@ RUN useradd \
# download and install gradle
RUN cd /tmp && wget https://services.gradle.org/distributions/gradle-6.8.3-bin.zip && unzip gradle-6.8.3-bin.zip && rm gradle-6.8.3-bin.zip && mv gradle-6.8.3 /opt/gradle
ENV PATH "${PATH}:/opt/gradle/bin"
RUN echo "export JAVA_HOME=$(dirname $(dirname $(readlink $(readlink $(which javac)))))" >> /etc/profile.d/java.sh
RUN echo "CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar" >> /etc/profile.d/java.sh
RUN source /etc/profile.d/java.sh
ENV JAVA_HOME=/etc/alternatives/jre
RUN alternatives --auto java && alternatives --auto javac

USER ${JENKINS_USERID}

Expand Down

0 comments on commit b5cff96

Please sign in to comment.