Skip to content

Commit

Permalink
restore original jdk21 preview Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
lemeurherve committed May 6, 2024
1 parent 736eb51 commit 3c4c191
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 27 deletions.
41 changes: 15 additions & 26 deletions debian/preview/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
ARG DEBIAN_RELEASE=bookworm-20240423
FROM debian:"${DEBIAN_RELEASE}"-slim as jre-build
ARG JAVA_VERSION
ARG TARGETPLATFORM

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

# This Build ARG is populated by Docker
# Ref. https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
ARG TARGETPLATFORM

## Example of preview (EA) jdk21 JAVA_VERSION values:
# 21+35 (note: only one number before the "+")
# 21.0.1+12
## Example of preview (EA) release download link:
# https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21%2B35-ea-beta/OpenJDK21U-jdk_x64_linux_hotspot_ea_21-0-35.tar.gz
# https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.1%2B12-ea-beta/OpenJDK21U-jdk_x64_alpine-linux_hotspot_ea_21-0-1-12.tar.gz

ARG JAVA_VERSION
# hadolint ignore=DL3008
RUN set -x; apt-get update \
&& apt-get install --no-install-recommends -y \
Expand All @@ -29,27 +26,19 @@ RUN set -x; apt-get update \
&& tar -xzf /tmp/jdk.tar.gz -C /opt/ \
&& rm -f /tmp/jdk.tar.gz

ENV PATH="/opt/jdk-${JAVA_VERSION}/bin:${PATH}"

RUN if [[ "${TARGETPLATFORM}" != "linux/arm/v7" ]]; then \
case "$(jlink --version 2>&1)" in \
# jlink version 11 has less features than JDK17+
"11."*) set -- "--strip-debug" "--compress=2" ;; \
"17."*) set -- "--strip-java-debug-attributes" "--compress=2" ;; \
# the compression argument is different for JDK21
"21."*) set -- "--strip-java-debug-attributes" "--compress=zip-6" ;; \
*) echo "ERROR: unmanaged jlink version pattern" && exit 1 ;; \
esac; \
jlink \
"$1" \
"$2" \
--add-modules ALL-MODULE-PATH \
--no-man-pages \
--no-header-files \
--output /javaruntime; \
else \
cp -r "/opt/jdk-${JAVA_VERSION}" /javaruntime; \
fi
ENV PATH=/opt/jdk-${JAVA_VERSION}/bin:$PATH

RUN if test "${TARGETPLATFORM}" != 'linux/arm/v7'; then \
jlink \
--add-modules ALL-MODULE-PATH \
--no-man-pages \
--compress=zip-6 \
--output /javaruntime; \
# It is acceptable to have a larger image in arm/v7 (arm 32 bits) environment.
# Because jlink fails with the error "jmods: Value too large for defined data type" error.
else \
cp -r "/opt/jdk-${JAVA_VERSION}" /javaruntime; \
fi

## Agent image target
FROM debian:"${DEBIAN_RELEASE}" AS agent
Expand Down
2 changes: 1 addition & 1 deletion docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ variable "JAVA21_VERSION" {
}

variable "JAVA21_PREVIEW_VERSION" {
default = "21.0.1_12"
default = "21.0.1+12"
}

function "orgrepo" {
Expand Down

0 comments on commit 3c4c191

Please sign in to comment.