From 3c4c191f414189571cbb1a4ca218d0f723104fdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Le=20Meur?= Date: Mon, 6 May 2024 22:49:51 +0200 Subject: [PATCH] restore original jdk21 preview Dockerfile --- debian/preview/Dockerfile | 41 ++++++++++++++------------------------- docker-bake.hcl | 2 +- 2 files changed, 16 insertions(+), 27 deletions(-) diff --git a/debian/preview/Dockerfile b/debian/preview/Dockerfile index d9e072883..b92989c8f 100644 --- a/debian/preview/Dockerfile +++ b/debian/preview/Dockerfile @@ -1,12 +1,10 @@ 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 @@ -14,7 +12,6 @@ ARG TARGETPLATFORM # 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 \ @@ -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 diff --git a/docker-bake.hcl b/docker-bake.hcl index 20f7f9d95..069dce853 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -121,7 +121,7 @@ variable "JAVA21_VERSION" { } variable "JAVA21_PREVIEW_VERSION" { - default = "21.0.1_12" + default = "21.0.1+12" } function "orgrepo" {