Skip to content

Commit

Permalink
Merge pull request #1717 from gounthar/alma-should-not-use-debian
Browse files Browse the repository at this point in the history
fix(jdk11): Alma and Rhel shouldn't use a Jammy image as the JDK source.
  • Loading branch information
dduportal authored Sep 18, 2023
2 parents 64e7a6e + d4dbf59 commit 02f6cfd
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 20 deletions.
30 changes: 20 additions & 10 deletions 11/almalinux/almalinux8/hotspot/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
FROM eclipse-temurin:11.0.20.1_1-jdk-jammy as jre-build

# Generate smaller java runtime without unneeded files
# for now we include the full module path to maintain compatibility
# while still saving space (approx 200mb from the full distribution)
RUN jlink \
--add-modules ALL-MODULE-PATH \
--no-man-pages \
--compress=2 \
--output /javaruntime
ARG JAVA_VERSION=11.0.20.1_1
FROM almalinux:8.8 as jre-build
ARG JAVA_VERSION

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

RUN set -x \
&& dnf -y upgrade-minimal --security \
&& dnf install -y ca-certificates jq wget \
&& JAVA_MAJOR_VERSION=$(echo "$JAVA_VERSION" | awk -F'.' '{print $1}') \
&& JAVA_VERSION_ENCODED=$(echo "$JAVA_VERSION" | tr '_' '+' | jq "@uri" -jRr) \
&& JAVA_VERSION_FILENAME=$(echo "$JAVA_VERSION" | tr '_' '+') \
&& CONVERTED_ARCH=$(arch | sed -e 's/x86_64/x64/' -e 's/armv7l/arm/') \
&& wget --quiet https://github.com/adoptium/temurin"${JAVA_MAJOR_VERSION}"-binaries/releases/download/jdk-"${JAVA_VERSION_ENCODED}"/OpenJDK"${JAVA_MAJOR_VERSION}"U-jdk_"${CONVERTED_ARCH}"_linux_hotspot_"${JAVA_VERSION}".tar.gz -O /tmp/jdk.tar.gz \
&& mkdir -p /opt/jdk-"${JAVA_VERSION_FILENAME}" \
&& tar -xzf /tmp/jdk.tar.gz -C /opt/jdk-"${JAVA_VERSION_FILENAME}" --strip-components=1 \
&& rm -f /tmp/jdk.tar.gz \
&& export PATH=/opt/jdk-"${JAVA_VERSION_FILENAME}"/bin:$PATH \
&& jlink --add-modules ALL-MODULE-PATH --no-man-pages --compress=2 --output /javaruntime \
&& dnf clean all

FROM almalinux:8.8

Expand Down
30 changes: 20 additions & 10 deletions 11/rhel/ubi8/hotspot/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
FROM eclipse-temurin:11.0.20.1_1-jdk-jammy as jre-build

# Generate smaller java runtime without unneeded files
# for now we include the full module path to maintain compatibility
# while still saving space (approx 200mb from the full distribution)
RUN jlink \
--add-modules ALL-MODULE-PATH \
--no-man-pages \
--compress=2 \
--output /javaruntime
ARG JAVA_VERSION=11.0.20.1_1
FROM registry.access.redhat.com/ubi8/ubi:8.8-1032.1692772289 as jre-build
ARG JAVA_VERSION

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

RUN set -x \
&& dnf -y upgrade-minimal --security \
&& dnf install -y ca-certificates jq wget \
&& JAVA_MAJOR_VERSION=$(echo "$JAVA_VERSION" | awk -F'.' '{print $1}') \
&& JAVA_VERSION_ENCODED=$(echo "$JAVA_VERSION" | tr '_' '+' | jq "@uri" -jRr) \
&& JAVA_VERSION_FILENAME=$(echo "$JAVA_VERSION" | tr '_' '+') \
&& CONVERTED_ARCH=$(arch | sed -e 's/x86_64/x64/' -e 's/armv7l/arm/') \
&& wget --quiet https://github.com/adoptium/temurin"${JAVA_MAJOR_VERSION}"-binaries/releases/download/jdk-"${JAVA_VERSION_ENCODED}"/OpenJDK"${JAVA_MAJOR_VERSION}"U-jdk_"${CONVERTED_ARCH}"_linux_hotspot_"${JAVA_VERSION}".tar.gz -O /tmp/jdk.tar.gz \
&& mkdir -p /opt/jdk-"${JAVA_VERSION_FILENAME}" \
&& tar -xzf /tmp/jdk.tar.gz -C /opt/jdk-"${JAVA_VERSION_FILENAME}" --strip-components=1 \
&& rm -f /tmp/jdk.tar.gz \
&& export PATH=/opt/jdk-"${JAVA_VERSION_FILENAME}"/bin:$PATH \
&& jlink --add-modules ALL-MODULE-PATH --no-man-pages --compress=2 --output /javaruntime \
&& dnf clean all

FROM registry.access.redhat.com/ubi8/ubi:8.8-1032.1692772289

Expand Down
2 changes: 2 additions & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ target "almalinux_jdk11" {
JENKINS_SHA = JENKINS_SHA
COMMIT_SHA = COMMIT_SHA
PLUGIN_CLI_VERSION = PLUGIN_CLI_VERSION
JAVA_VERSION = JAVA11_VERSION
}
tags = [
tag(true, "almalinux"),
Expand Down Expand Up @@ -369,6 +370,7 @@ target "rhel_ubi8_jdk11" {
JENKINS_SHA = JENKINS_SHA
COMMIT_SHA = COMMIT_SHA
PLUGIN_CLI_VERSION = PLUGIN_CLI_VERSION
JAVA_VERSION = JAVA11_VERSION
}
tags = [
tag(true, "rhel-ubi8-jdk11"),
Expand Down

0 comments on commit 02f6cfd

Please sign in to comment.