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

Commit

Permalink
Add Java17 and use adoptium for Java 8, 11, 17
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahgraham committed Jul 19, 2022
1 parent 32c59d5 commit dd95d63
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 36 deletions.
73 changes: 65 additions & 8 deletions docker/cdt-infra-base/ubuntu-18.04/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,10 @@ RUN chmod 755 ${HOME}/.vnc/xstartup*.sh
####
# From this point forward is the extra standard tools for CDT

# Java, git and other tools
# git and other tools

RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
openjdk-8-jdk \
openjdk-11-jdk \
curl \
openssh-client \
wget \
Expand All @@ -76,11 +74,70 @@ ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8

ENV JAVA8_HOME /usr/lib/jvm/java-8-openjdk-amd64
ENV JAVA11_HOME /usr/lib/jvm/java-11-openjdk-amd64
# Default to JAVA11 being in use
RUN update-java-alternatives -s java-1.11.0-openjdk-amd64
ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-amd64

# Get release versions from Adoptium API: https://api.adoptium.net/q/swagger-ui/#/Release%20Info/getReleaseNames
ENV JDK8_VERSION jdk8u332-b09
ENV JDK11_VERSION jdk-11.0.15+10
ENV JDK17_VERSION jdk-17.0.3+7
ENV JAVA8_HOME /usr/lib/jvm/${JDK8_VERSION}
ENV JAVA11_HOME /usr/lib/jvm/${JDK11_VERSION}
ENV JAVA17_HOME /usr/lib/jvm/${JDK17_VERSION}

# Get Java from adoptium + header files for win32 & mac for cross compiling JNI libraries on Java 8, 11, 17
# TODO: Move these runs into a script, the only difference between each invocation is the env variables
RUN export JVERSION=${JDK8_VERSION} \
&& export JHOME=${JAVA8_HOME} \
&& mkdir /tmp/x && mkdir -p /usr/lib/jvm \
&& curl -sL "https://api.adoptium.net/v3/binary/version/${JVERSION}/linux/x64/jdk/hotspot/normal/eclipse?project=jdk" > /tmp/x/openjdk-linux.tar.gz \
&& mkdir /tmp/x/linux && cd /tmp/x/linux && tar xvf /tmp/x/openjdk-linux.tar.gz \
&& mv /tmp/x/linux/${JVERSION} /usr/lib/jvm \
&& curl -sL "https://api.adoptium.net/v3/binary/version/${JVERSION}/windows/x64/jdk/hotspot/normal/eclipse?project=jdk" > /tmp/x/openjdk-win32.zip \
&& curl -sL "https://api.adoptium.net/v3/binary/version/${JVERSION}/mac/x64/jdk/hotspot/normal/eclipse?project=jdk" > /tmp/x/openjdk-mac.tar.gz \
&& mkdir /tmp/x/win32 && cd /tmp/x/win32 && unzip /tmp/x/openjdk-win32.zip \
&& mkdir /tmp/x/mac && cd /tmp/x/mac && tar xvf /tmp/x/openjdk-mac.tar.gz \
&& cd $JHOME/include && for i in *.h; do diff $i /tmp/x/win32/${JVERSION}/include/$i ; done \
&& cd $JHOME/include && for i in *.h; do diff $i /tmp/x/mac/${JVERSION}/Contents/Home/include/$i ; done \
&& mv /tmp/x/win32/${JVERSION}/include/win32 $JHOME/include \
&& mv /tmp/x/mac/${JVERSION}/Contents/Home/include/darwin $JHOME/include \
&& find $JHOME/include \
&& rm -rf /tmp/x
RUN export JVERSION=${JDK11_VERSION} \
&& export JHOME=${JAVA11_HOME} \
&& mkdir /tmp/x && mkdir -p /usr/lib/jvm \
&& curl -sL "https://api.adoptium.net/v3/binary/version/${JVERSION}/linux/x64/jdk/hotspot/normal/eclipse?project=jdk" > /tmp/x/openjdk-linux.tar.gz \
&& mkdir /tmp/x/linux && cd /tmp/x/linux && tar xvf /tmp/x/openjdk-linux.tar.gz \
&& mv /tmp/x/linux/${JVERSION} /usr/lib/jvm \
&& curl -sL "https://api.adoptium.net/v3/binary/version/${JVERSION}/windows/x64/jdk/hotspot/normal/eclipse?project=jdk" > /tmp/x/openjdk-win32.zip \
&& curl -sL "https://api.adoptium.net/v3/binary/version/${JVERSION}/mac/x64/jdk/hotspot/normal/eclipse?project=jdk" > /tmp/x/openjdk-mac.tar.gz \
&& mkdir /tmp/x/win32 && cd /tmp/x/win32 && unzip /tmp/x/openjdk-win32.zip \
&& mkdir /tmp/x/mac && cd /tmp/x/mac && tar xvf /tmp/x/openjdk-mac.tar.gz \
&& cd $JHOME/include && for i in *.h; do diff $i /tmp/x/win32/${JVERSION}/include/$i ; done \
&& cd $JHOME/include && for i in *.h; do diff $i /tmp/x/mac/${JVERSION}/Contents/Home/include/$i ; done \
&& mv /tmp/x/win32/${JVERSION}/include/win32 $JHOME/include \
&& mv /tmp/x/mac/${JVERSION}/Contents/Home/include/darwin $JHOME/include \
&& find $JHOME/include \
&& rm -rf /tmp/x
RUN export JVERSION=${JDK17_VERSION} \
&& export JHOME=${JAVA17_HOME} \
&& mkdir /tmp/x && mkdir -p /usr/lib/jvm \
&& curl -sL "https://api.adoptium.net/v3/binary/version/${JVERSION}/linux/x64/jdk/hotspot/normal/eclipse?project=jdk" > /tmp/x/openjdk-linux.tar.gz \
&& mkdir /tmp/x/linux && cd /tmp/x/linux && tar xvf /tmp/x/openjdk-linux.tar.gz \
&& mv /tmp/x/linux/${JVERSION} /usr/lib/jvm \
&& curl -sL "https://api.adoptium.net/v3/binary/version/${JVERSION}/windows/x64/jdk/hotspot/normal/eclipse?project=jdk" > /tmp/x/openjdk-win32.zip \
&& curl -sL "https://api.adoptium.net/v3/binary/version/${JVERSION}/mac/x64/jdk/hotspot/normal/eclipse?project=jdk" > /tmp/x/openjdk-mac.tar.gz \
&& mkdir /tmp/x/win32 && cd /tmp/x/win32 && unzip /tmp/x/openjdk-win32.zip \
&& mkdir /tmp/x/mac && cd /tmp/x/mac && tar xvf /tmp/x/openjdk-mac.tar.gz \
&& cd $JHOME/include && for i in *.h; do diff $i /tmp/x/win32/${JVERSION}/include/$i ; done \
&& cd $JHOME/include && for i in *.h; do diff $i /tmp/x/mac/${JVERSION}/Contents/Home/include/$i ; done \
&& mv /tmp/x/win32/${JVERSION}/include/win32 $JHOME/include \
&& mv /tmp/x/mac/${JVERSION}/Contents/Home/include/darwin $JHOME/include \
&& find $JHOME/include \
&& rm -rf /tmp/x


# Default to JAVA17 being in use
ENV PATH="${JAVA17_HOME}/bin:${PATH}"
ENV JAVA_HOME ${JAVA17_HOME}

# The version of git in Ubuntu 18.04 causes problems, so use newer git. See Bug 548519
RUN echo "deb http://ppa.launchpad.net/git-core/ppa/ubuntu bionic main" > /etc/apt/sources.list.d/git-core-ubuntu-ppa-bionic.list
Expand Down
28 changes: 0 additions & 28 deletions docker/cdt-infra-eclipse-full/ubuntu-18.04/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,34 +45,6 @@ RUN curl -sL https://deb.nodesource.com/setup_14.x | bash \
COPY --from=cdt-infra-all-gdbs:ubuntu-18.04 /shared/common/gdb/gdb-all /shared/common/gdb/gdb-all
ENV PATH="/shared/common/gdb/gdb-all/bin:${PATH}"

# Get header files for win32 & mac for cross compiling JNI libraries on Java 8
ENV JDK8_VERSION=jdk8u252-b09
RUN mkdir /tmp/x \
&& curl -sL https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u252-b09.1/OpenJDK8U-jdk_x64_windows_hotspot_8u252b09.zip > /tmp/x/openjdk-win32.zip \
&& curl -sL https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u252-b09.1/OpenJDK8U-jdk_x64_mac_hotspot_8u252b09.tar.gz > /tmp/x/openjdk-mac.tar.gz \
&& mkdir /tmp/x/win32 && cd /tmp/x/win32 && unzip /tmp/x/openjdk-win32.zip \
&& mkdir /tmp/x/mac && cd /tmp/x/mac && tar xvf /tmp/x/openjdk-mac.tar.gz \
&& cd $JAVA8_HOME/include && for i in *.h; do diff $i /tmp/x/win32/${JDK8_VERSION}/include/$i ; done \
&& cd $JAVA8_HOME/include && for i in *.h; do diff $i /tmp/x/mac/${JDK8_VERSION}/Contents/Home/include/$i ; done \
&& mv /tmp/x/win32/${JDK8_VERSION}/include/win32 $JAVA8_HOME/include \
&& mv /tmp/x/mac/${JDK8_VERSION}/Contents/Home/include/darwin $JAVA8_HOME/include \
&& find $JAVA8_HOME/include \
&& rm -rf /tmp/x

# Get header files for win32 & mac for cross compiling JNI libraries on Java 11
ENV JDK11_VERSION=jdk-11.0.7+10
RUN mkdir /tmp/x \
&& curl -sL https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.7%2B10.2/OpenJDK11U-jdk_x64_windows_hotspot_11.0.7_10.zip > /tmp/x/openjdk-win32.zip \
&& curl -sL https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.7%2B10/OpenJDK11U-jdk_x64_mac_hotspot_11.0.7_10.tar.gz > /tmp/x/openjdk-mac.tar.gz \
&& mkdir /tmp/x/win32 && cd /tmp/x/win32 && unzip /tmp/x/openjdk-win32.zip \
&& mkdir /tmp/x/mac && cd /tmp/x/mac && tar xvf /tmp/x/openjdk-mac.tar.gz \
&& cd $JAVA11_HOME/include && for i in *.h; do diff $i /tmp/x/win32/${JDK11_VERSION}/include/$i ; done \
&& cd $JAVA11_HOME/include && for i in *.h; do diff $i /tmp/x/mac/${JDK11_VERSION}/Contents/Home/include/$i ; done \
&& mv /tmp/x/win32/${JDK11_VERSION}/include/win32 $JAVA11_HOME/include \
&& mv /tmp/x/mac/${JDK11_VERSION}/Contents/Home/include/darwin $JAVA11_HOME/include \
&& find $JAVA11_HOME/include \
&& rm -rf /tmp/x

# Get pre-built MacOSX toolchain from other image (this also
# requires clang to be listed in the installs above)
COPY --from=cdt-infra-build-macos-sdk:ubuntu-18.04 /opt/osxcross/target /opt/osxcross/target
Expand Down

0 comments on commit dd95d63

Please sign in to comment.