-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Install Java 21 and 22 (closes #276)
- Loading branch information
1 parent
3c12b9a
commit aa06599
Showing
8 changed files
with
337 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
FROM eclipse-temurin:21-jdk-alpine AS java21 | ||
|
||
FROM eclipse-temurin:21-jdk-alpine | ||
|
||
COPY --from=java21 /opt/java/openjdk /opt/java/openjdk21 | ||
RUN set -o errexit -o nounset \ | ||
&& ln -s /opt/java/openjdk21 /opt/java/openjdk | ||
ENV JAVA21_HOME /opt/java/openjdk21 | ||
ENV JAVA22_HOME /opt/java/openjdk22 | ||
|
||
CMD ["gradle"] | ||
|
||
ENV GRADLE_HOME /opt/gradle | ||
|
||
RUN set -o errexit -o nounset \ | ||
&& echo "Adding gradle user and group" \ | ||
&& addgroup --system --gid 1000 gradle \ | ||
&& adduser --system --ingroup gradle --uid 1000 --shell /bin/ash gradle \ | ||
&& mkdir /home/gradle/.gradle \ | ||
&& chown -R gradle:gradle /home/gradle \ | ||
\ | ||
&& echo "Symlinking root Gradle cache to gradle Gradle cache" \ | ||
&& ln -s /home/gradle/.gradle /root/.gradle \ | ||
\ | ||
&& echo "Ensuring Gradle uses Java 21" \ | ||
&& echo "org.gradle.java.installations.auto-detect=false" > /home/gradle/.gradle/gradle.properties \ | ||
&& echo "org.gradle.java.installations.auto-download=false" >> /home/gradle/.gradle/gradle.properties \ | ||
&& echo "org.gradle.java.installations.fromEnv=JAVA21_HOME" >> /home/gradle/.gradle/gradle.properties | ||
|
||
VOLUME /home/gradle/.gradle | ||
|
||
WORKDIR /home/gradle | ||
|
||
RUN set -o errexit -o nounset \ | ||
&& echo "Installing VCSes" \ | ||
&& apk add --no-cache \ | ||
git \ | ||
git-lfs \ | ||
mercurial \ | ||
subversion \ | ||
\ | ||
&& echo "Testing VCSes" \ | ||
&& which git \ | ||
&& which git-lfs \ | ||
&& which hg \ | ||
&& which svn | ||
|
||
ENV GRADLE_VERSION 8.7 | ||
ARG GRADLE_DOWNLOAD_SHA256=544c35d6bd849ae8a5ed0bcea39ba677dc40f49df7d1835561582da2009b961d | ||
RUN set -o errexit -o nounset \ | ||
&& echo "Downloading Gradle" \ | ||
&& wget --no-verbose --output-document=gradle.zip "https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip" \ | ||
\ | ||
&& echo "Checking Gradle download hash" \ | ||
&& echo "${GRADLE_DOWNLOAD_SHA256} *gradle.zip" | sha256sum -c - \ | ||
\ | ||
&& echo "Installing Gradle" \ | ||
&& unzip gradle.zip \ | ||
&& rm gradle.zip \ | ||
&& mv "gradle-${GRADLE_VERSION}" "${GRADLE_HOME}/" \ | ||
&& ln -s "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle | ||
|
||
USER gradle | ||
|
||
RUN set -o errexit -o nounset \ | ||
&& echo "Testing Gradle installation" \ | ||
&& gradle --version | ||
|
||
USER root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
FROM ubuntu:jammy | ||
|
||
CMD ["gradle"] | ||
|
||
ENV GRADLE_HOME /opt/gradle | ||
|
||
RUN set -o errexit -o nounset \ | ||
&& echo "Adding gradle user and group" \ | ||
&& groupadd --system --gid 1000 gradle \ | ||
&& useradd --system --gid gradle --uid 1000 --shell /bin/bash --create-home gradle \ | ||
&& mkdir /home/gradle/.gradle \ | ||
\ | ||
&& echo "Symlinking root Gradle cache to gradle Gradle cache" \ | ||
&& ln --symbolic /home/gradle/.gradle /root/.gradle \ | ||
\ | ||
&& echo "Ensuring Gradle uses Java 20" \ | ||
&& echo "org.gradle.java.installations.auto-detect=false" > /home/gradle/.gradle/gradle.properties \ | ||
&& echo "org.gradle.java.installations.auto-download=false" >> /home/gradle/.gradle/gradle.properties \ | ||
&& echo "org.gradle.java.installations.fromEnv=JAVA20_HOME" >> /home/gradle/.gradle/gradle.properties | ||
|
||
VOLUME /home/gradle/.gradle | ||
|
||
WORKDIR /home/gradle | ||
|
||
RUN set -o errexit -o nounset \ | ||
&& export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt-get update \ | ||
&& apt-get install --yes --no-install-recommends \ | ||
binutils \ | ||
ca-certificates \ | ||
curl \ | ||
fontconfig \ | ||
locales \ | ||
p11-kit \ | ||
tzdata \ | ||
unzip \ | ||
wget \ | ||
\ | ||
gcc \ | ||
libc-dev \ | ||
libz-dev \ | ||
zlib1g-dev \ | ||
\ | ||
bzr \ | ||
git \ | ||
git-lfs \ | ||
mercurial \ | ||
openssh-client \ | ||
subversion \ | ||
&& rm --recursive --force /var/lib/apt/lists/* \ | ||
\ | ||
&& echo "Testing VCSes" \ | ||
&& which bzr \ | ||
&& which git \ | ||
&& which git-lfs \ | ||
&& which hg \ | ||
&& which svn | ||
|
||
ENV JAVA_HOME=/opt/java/graalvm | ||
ENV JAVA21_HOME /opt/java/graalvm21 | ||
ENV JAVA22_HOME /opt/java/graalvm22 | ||
RUN set -o errexit -o nounset \ | ||
&& mkdir /opt/java \ | ||
\ | ||
&& echo "Downloading GraalVM 21" \ | ||
&& JDK_21_VERSION=21.0.2 \ | ||
&& GRAALVM_AMD64_DOWNLOAD_SHA256=b048069aaa3a99b84f5b957b162cc181a32a4330cbc35402766363c5be76ae48 \ | ||
&& GRAALVM_AARCH64_DOWNLOAD_SHA256=a34be691ce68f0acf4655c7c6c63a9a49ed276a11859d7224fd94fc2f657cd7a \ | ||
&& ARCHITECTURE=$(dpkg --print-architecture) \ | ||
&& if [ "${ARCHITECTURE}" = "amd64" ]; then GRAALVM_ARCHITECTURE=linux-x64; fi \ | ||
&& if [ "${ARCHITECTURE}" = "arm64" ]; then GRAALVM_ARCHITECTURE=linux-aarch64; fi \ | ||
&& GRAALVM_PKG=https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-${JDK_21_VERSION}/graalvm-community-jdk-${JDK_21_VERSION}_${GRAALVM_ARCHITECTURE}_bin.tar.gz \ | ||
&& wget --no-verbose --output-document=graalvm.tar.gz "${GRAALVM_PKG}" \ | ||
\ | ||
&& echo "Checking GraalVM 21 download hash" \ | ||
&& if [ "${ARCHITECTURE}" = "amd64" ]; then GRAALVM_DOWNLOAD_SHA256="${GRAALVM_AMD64_DOWNLOAD_SHA256}"; fi \ | ||
&& if [ "${ARCHITECTURE}" = "arm64" ]; then GRAALVM_DOWNLOAD_SHA256="${GRAALVM_AARCH64_DOWNLOAD_SHA256}"; fi \ | ||
&& echo "${GRAALVM_DOWNLOAD_SHA256} *graalvm.tar.gz" | sha256sum --check - \ | ||
\ | ||
&& echo "Installing GraalVM 21" \ | ||
&& tar --extract --gunzip --file graalvm.tar.gz \ | ||
&& rm graalvm.tar.gz \ | ||
&& mv graalvm-* /opt/java/graalvm21 \ | ||
\ | ||
&& echo "Downloading GraalVM 22" \ | ||
&& JDK_22_VERSION=22.0.0 \ | ||
&& GRAALVM_AMD64_DOWNLOAD_SHA256=e5eeb486a23101753f18181d002c3ede9da13c463fb61d3ea448abe774db0657 \ | ||
&& GRAALVM_AARCH64_DOWNLOAD_SHA256=da9a0e11b110ebccff33ade502516d00f574ec3247868007e452cef4143e0904 \ | ||
&& ARCHITECTURE=$(dpkg --print-architecture) \ | ||
&& if [ "${ARCHITECTURE}" = "amd64" ]; then GRAALVM_ARCHITECTURE=linux-x64; fi \ | ||
&& if [ "${ARCHITECTURE}" = "arm64" ]; then GRAALVM_ARCHITECTURE=linux-aarch64; fi \ | ||
&& GRAALVM_PKG=https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-${JDK_22_VERSION}/graalvm-community-jdk-${JDK_22_VERSION}_${GRAALVM_ARCHITECTURE}_bin.tar.gz \ | ||
&& wget --no-verbose --output-document=graalvm.tar.gz "${GRAALVM_PKG}" \ | ||
\ | ||
&& echo "Checking GraalVM 22 download hash" \ | ||
&& if [ "${ARCHITECTURE}" = "amd64" ]; then GRAALVM_DOWNLOAD_SHA256="${GRAALVM_AMD64_DOWNLOAD_SHA256}"; fi \ | ||
&& if [ "${ARCHITECTURE}" = "arm64" ]; then GRAALVM_DOWNLOAD_SHA256="${GRAALVM_AARCH64_DOWNLOAD_SHA256}"; fi \ | ||
&& echo "${GRAALVM_DOWNLOAD_SHA256} *graalvm.tar.gz" | sha256sum --check - \ | ||
\ | ||
&& echo "Installing GraalVM 22" \ | ||
&& tar --extract --gunzip --file graalvm.tar.gz \ | ||
&& rm graalvm.tar.gz \ | ||
&& mv graalvm-* /opt/java/graalvm22 \ | ||
\ | ||
&& echo "Default Java to GraalVM 22" \ | ||
&& ln --symbolic /opt/java/graalvm22 /opt/java/graalvm \ | ||
&& for bin in /opt/java/graalvm22/bin/*; do \ | ||
base="$(basename "$bin")"; \ | ||
[ ! -e "/usr/bin/$base" ]; \ | ||
update-alternatives --install "/usr/bin/${base}" "${base}" "${bin}" 1; \ | ||
done \ | ||
\ | ||
&& echo "Testing GraalVM installation" \ | ||
&& java --version \ | ||
&& javac --version \ | ||
&& native-image --version | ||
|
||
ENV GRADLE_VERSION 8.7 | ||
ARG GRADLE_DOWNLOAD_SHA256=544c35d6bd849ae8a5ed0bcea39ba677dc40f49df7d1835561582da2009b961d | ||
RUN set -o errexit -o nounset \ | ||
&& echo "Downloading Gradle" \ | ||
&& wget --no-verbose --output-document=gradle.zip "https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip" \ | ||
\ | ||
&& echo "Checking Gradle download hash" \ | ||
&& echo "${GRADLE_DOWNLOAD_SHA256} *gradle.zip" | sha256sum --check - \ | ||
\ | ||
&& echo "Installing Gradle" \ | ||
&& unzip gradle.zip \ | ||
&& rm gradle.zip \ | ||
&& mv "gradle-${GRADLE_VERSION}" "${GRADLE_HOME}/" \ | ||
&& ln --symbolic "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle \ | ||
\ | ||
&& echo "Testing Gradle installation" \ | ||
&& gradle --version \ | ||
\ | ||
# chown last so that it applies to /home/gradle/.gradle/native | ||
&& chown --recursive gradle:gradle /home/gradle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
FROM eclipse-temurin:22-jdk-jammy AS java22 | ||
|
||
FROM eclipse-temurin:21-jdk-jammy | ||
|
||
COPY --from=java22 /opt/java/openjdk /opt/java/openjdk22 | ||
RUN set -o errexit -o nounset \ | ||
&& ln --symbolic /opt/java/openjdk21 /opt/java/openjdk | ||
ENV JAVA21_HOME /opt/java/openjdk21 | ||
ENV JAVA22_HOME /opt/java/openjdk22 | ||
|
||
CMD ["gradle"] | ||
|
||
ENV GRADLE_HOME /opt/gradle | ||
|
||
RUN set -o errexit -o nounset \ | ||
&& echo "Adding gradle user and group" \ | ||
&& groupadd --system --gid 1000 gradle \ | ||
&& useradd --system --gid gradle --uid 1000 --shell /bin/bash --create-home gradle \ | ||
&& mkdir /home/gradle/.gradle \ | ||
&& chown --recursive gradle:gradle /home/gradle \ | ||
\ | ||
&& echo "Symlinking root Gradle cache to gradle Gradle cache" \ | ||
&& ln --symbolic /home/gradle/.gradle /root/.gradle \ | ||
\ | ||
&& echo "Ensuring Gradle uses Java 22" \ | ||
&& echo "org.gradle.java.installations.auto-detect=false" > /home/gradle/.gradle/gradle.properties \ | ||
&& echo "org.gradle.java.installations.auto-download=false" >> /home/gradle/.gradle/gradle.properties \ | ||
&& echo "org.gradle.java.installations.fromEnv=JAVA22_HOME" >> /home/gradle/.gradle/gradle.properties | ||
|
||
VOLUME /home/gradle/.gradle | ||
|
||
WORKDIR /home/gradle | ||
|
||
RUN set -o errexit -o nounset \ | ||
&& apt-get update \ | ||
&& apt-get install --yes --no-install-recommends \ | ||
unzip \ | ||
wget \ | ||
\ | ||
bzr \ | ||
git \ | ||
git-lfs \ | ||
mercurial \ | ||
openssh-client \ | ||
subversion \ | ||
&& rm --recursive --force /var/lib/apt/lists/* \ | ||
\ | ||
&& echo "Testing VCSes" \ | ||
&& which bzr \ | ||
&& which git \ | ||
&& which git-lfs \ | ||
&& which hg \ | ||
&& which svn | ||
|
||
ENV GRADLE_VERSION 8.7 | ||
ARG GRADLE_DOWNLOAD_SHA256=544c35d6bd849ae8a5ed0bcea39ba677dc40f49df7d1835561582da2009b961d | ||
RUN set -o errexit -o nounset \ | ||
&& echo "Downloading Gradle" \ | ||
&& wget --no-verbose --output-document=gradle.zip "https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip" \ | ||
\ | ||
&& echo "Checking download hash" \ | ||
&& echo "${GRADLE_DOWNLOAD_SHA256} *gradle.zip" | sha256sum --check - \ | ||
\ | ||
&& echo "Installing Gradle" \ | ||
&& unzip gradle.zip \ | ||
&& rm gradle.zip \ | ||
&& mv "gradle-${GRADLE_VERSION}" "${GRADLE_HOME}/" \ | ||
&& ln --symbolic "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle \ | ||
\ | ||
&& echo "Testing Gradle installation" \ | ||
&& gradle --version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.