From a7cdefa7397118bdc342cb0b0586d07ad8329c8e Mon Sep 17 00:00:00 2001 From: Gaurav Saini <147703805+gauravsaini04@users.noreply.github.com> Date: Mon, 28 Oct 2024 06:08:49 +0000 Subject: [PATCH 1/2] [java] - add jdk 23 to be supported latest version --- src/java/.devcontainer/Dockerfile | 34 +++++++++++++++++++++++-------- src/java/README.md | 3 ++- src/java/manifest.json | 29 +++++++++++++++++++++++++- 3 files changed, 55 insertions(+), 11 deletions(-) diff --git a/src/java/.devcontainer/Dockerfile b/src/java/.devcontainer/Dockerfile index 852f11588..da5a8d3c8 100644 --- a/src/java/.devcontainer/Dockerfile +++ b/src/java/.devcontainer/Dockerfile @@ -1,5 +1,5 @@ # This Dockerfile uses separate build arguments instead of VARIANT -ARG TARGET_JAVA_VERSION=21 +ARG TARGET_JAVA_VERSION=23 ARG BASE_IMAGE_VERSION_CODENAME=bookworm FROM mcr.microsoft.com/devcontainers/base:${BASE_IMAGE_VERSION_CODENAME} @@ -14,21 +14,37 @@ ENV LANG en_US.UTF-8 RUN arch="$(dpkg --print-architecture)" \ && case "$arch" in \ "amd64") \ + if [ "$TARGET_JAVA_VERSION" -gt 21 ]; then \ + jdkUrl="https://download.oracle.com/java/${TARGET_JAVA_VERSION}/latest/jdk-${TARGET_JAVA_VERSION}_linux-x64_bin.tar.gz"; \ + else \ jdkUrl="https://aka.ms/download-jdk/microsoft-jdk-${TARGET_JAVA_VERSION}-linux-x64.tar.gz"; \ - ;; \ - "arm64") \ + fi \ + ;; \ + "arm64") \ + if [ "$TARGET_JAVA_VERSION" -gt 21 ]; then \ + jdkUrl="https://download.oracle.com/java/${TARGET_JAVA_VERSION}/latest/jdk-${TARGET_JAVA_VERSION}_linux-aarch64_bin.tar.gz"; \ + else \ jdkUrl="https://aka.ms/download-jdk/microsoft-jdk-${TARGET_JAVA_VERSION}-linux-aarch64.tar.gz"; \ - ;; \ + fi \ + ;; \ *) echo >&2 "error: unsupported architecture: '$arch'"; exit 1 ;; \ esac \ \ - && wget --progress=dot:giga -O msopenjdk.tar.gz "${jdkUrl}" \ - && wget --progress=dot:giga -O sha256sum.txt "${jdkUrl}.sha256sum.txt" \ + && wget --progress=dot:giga -O msopenjdk.tar.gz "${jdkUrl}" \ + && if [ "$TARGET_JAVA_VERSION" -gt 21 ]; then \ + wget --progress=dot:giga -O jdk-${TARGET_JAVA_VERSION}_linux-${arch}_sha256 "${jdkUrl}.sha256"; \ + else \ + wget --progress=dot:giga -O jdk-${TARGET_JAVA_VERSION}_linux-${arch}_sha256sum.txt "${jdkUrl}.sha256sum.txt"; \ + fi \ \ - && sha256sumText=$(cat sha256sum.txt) \ - && sha256=$(expr substr "${sha256sumText}" 1 64) \ + && if [ "$TARGET_JAVA_VERSION" -gt 21 ]; then \ + sha256sumText=$(cat jdk-${TARGET_JAVA_VERSION}_linux-${arch}_sha256); \ + else \ + sha256sumText=$(cat jdk-${TARGET_JAVA_VERSION}_linux-${arch}_sha256sum.txt); \ + fi \ + && sha256=$(echo "${sha256sumText}" | awk '{print $1}') \ && echo "${sha256} msopenjdk.tar.gz" | sha256sum --strict --check - \ - && rm sha256sum.txt* \ + && rm jdk-${TARGET_JAVA_VERSION}_linux-${arch}_sha256* \ \ && mkdir -p "$JAVA_HOME" \ && tar --extract \ diff --git a/src/java/README.md b/src/java/README.md index 5a6ca289a..3d520cbbd 100644 --- a/src/java/README.md +++ b/src/java/README.md @@ -9,7 +9,7 @@ | *Categories* | Core, Languages | | *Image type* | Dockerfile | | *Published images* | mcr.microsoft.com/devcontainers/java | -| *Available image variants* | 11 / 11-bookworm, 17 / 17-bookworm, 21 / 21-bookworm, 11-bullseye, 17-bullseye, 21-bullseye ([full list](https://mcr.microsoft.com/v2/devcontainers/java/tags/list)) | +| *Available image variants* | 11 / 11-bookworm, 17 / 17-bookworm, 21 / 21-bookworm, 23 / 23-bookworm, 11-bullseye, 17-bullseye, 21-bullseye, 23-bullseye ([full list](https://mcr.microsoft.com/v2/devcontainers/java/tags/list)) | | *Published image architecture(s)* | x86-64, arm64/aarch64 for `bookworm`, and `bullseye` variants | | *Container host OS support* | Linux, macOS, Windows | | *Container OS* | Debian | @@ -22,6 +22,7 @@ See **[history](history)** for information on the contents of published images. You can directly reference pre-built versions of `Dockerfile` by using the `image` property in `.devcontainer/devcontainer.json` or updating the `FROM` statement in your own `Dockerfile` to one of the following. An example `Dockerfile` is included in this repository. - `mcr.microsoft.com/devcontainers/java` (latest) +- `mcr.microsoft.com/devcontainers/java:23` (or `23-bookworm`, `23-bullseye` to pin to an OS version) - `mcr.microsoft.com/devcontainers/java:21` (or `21-bookworm`, `21-bullseye` to pin to an OS version) - `mcr.microsoft.com/devcontainers/java:11` (or `17-bookworm`, `11-bullseye` to pin to an OS version) - `mcr.microsoft.com/devcontainers/java:17` (or `17-bookworm`, `17-bullseye` to pin to an OS version) diff --git a/src/java/manifest.json b/src/java/manifest.json index e0a422a4a..f69dcf271 100644 --- a/src/java/manifest.json +++ b/src/java/manifest.json @@ -1,7 +1,9 @@ { "version": "1.1.15", "variants": [ + "23-bookworm", "21-bookworm", + "23-bullseye", "21-bullseye", "17-bookworm", "17-bullseye", @@ -9,11 +11,15 @@ "11-bullseye" ], "build": { - "latest": "21-bookworm", + "latest": "23-bookworm", "rootDistro": "debian", "parent": "base-debian", "idMismatch": "true", "variantBuildArgs": { + "23-bookworm": { + "TARGET_JAVA_VERSION": "23", + "BASE_IMAGE_VERSION_CODENAME": "bookworm" + }, "21-bookworm": { "TARGET_JAVA_VERSION": "21", "BASE_IMAGE_VERSION_CODENAME": "bookworm" @@ -26,6 +32,10 @@ "TARGET_JAVA_VERSION": "11", "BASE_IMAGE_VERSION_CODENAME": "bookworm" }, + "23-bullseye": { + "TARGET_JAVA_VERSION": "23", + "BASE_IMAGE_VERSION_CODENAME": "bullseye" + }, "21-bullseye": { "TARGET_JAVA_VERSION": "21", "BASE_IMAGE_VERSION_CODENAME": "bullseye" @@ -40,6 +50,10 @@ } }, "architectures": { + "23-bookworm": [ + "linux/amd64", + "linux/arm64" + ], "21-bookworm": [ "linux/amd64", "linux/arm64" @@ -52,6 +66,10 @@ "linux/amd64", "linux/arm64" ], + "23-bullseye": [ + "linux/amd64", + "linux/arm64" + ], "21-bullseye": [ "linux/amd64", "linux/arm64" @@ -69,6 +87,11 @@ "java:${VERSION}-${VARIANT}" ], "variantTags": { + "23-bookworm": [ + "java:${VERSION}-23", + "java:${VERSION}-23-jdk-bookworm", + "java:${VERSION}-bookworm" + ], "21-bookworm": [ "java:${VERSION}-21", "java:${VERSION}-21-jdk-bookworm", @@ -82,6 +105,10 @@ "java:${VERSION}-11", "java:${VERSION}-11-jdk-bookworm" ], + "23-bullseye": [ + "java:${VERSION}-23-jdk-bullseye", + "java:${VERSION}-bullseye" + ], "21-bullseye": [ "java:${VERSION}-21-jdk-bullseye", "java:${VERSION}-bullseye" From 2d73db1c0cb494458785ff77dd4c46d4cea4d432 Mon Sep 17 00:00:00 2001 From: Gaurav Saini <147703805+gauravsaini04@users.noreply.github.com> Date: Thu, 21 Nov 2024 02:28:52 +0000 Subject: [PATCH 2/2] commented the adoptium links for optional download as jdk 23 is not available from aka.ms yet --- src/java/.devcontainer/Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/java/.devcontainer/Dockerfile b/src/java/.devcontainer/Dockerfile index da5a8d3c8..4fc2fb0eb 100644 --- a/src/java/.devcontainer/Dockerfile +++ b/src/java/.devcontainer/Dockerfile @@ -14,7 +14,9 @@ ENV LANG en_US.UTF-8 RUN arch="$(dpkg --print-architecture)" \ && case "$arch" in \ "amd64") \ + # jdk 23 is not available from aka.ms if [ "$TARGET_JAVA_VERSION" -gt 21 ]; then \ + # https://github.com/adoptium/temurin23-binaries/releases/download/jdk-23.0.1%2B11/OpenJDK23U-debugimage_x64_linux_hotspot_23.0.1_11.tar.gz jdkUrl="https://download.oracle.com/java/${TARGET_JAVA_VERSION}/latest/jdk-${TARGET_JAVA_VERSION}_linux-x64_bin.tar.gz"; \ else \ jdkUrl="https://aka.ms/download-jdk/microsoft-jdk-${TARGET_JAVA_VERSION}-linux-x64.tar.gz"; \ @@ -22,6 +24,7 @@ RUN arch="$(dpkg --print-architecture)" \ ;; \ "arm64") \ if [ "$TARGET_JAVA_VERSION" -gt 21 ]; then \ + # https://github.com/adoptium/temurin23-binaries/releases/download/jdk-23.0.1%2B11/OpenJDK23U-debugimage_aarch64_linux_hotspot_23.0.1_11.tar.gz jdkUrl="https://download.oracle.com/java/${TARGET_JAVA_VERSION}/latest/jdk-${TARGET_JAVA_VERSION}_linux-aarch64_bin.tar.gz"; \ else \ jdkUrl="https://aka.ms/download-jdk/microsoft-jdk-${TARGET_JAVA_VERSION}-linux-aarch64.tar.gz"; \ @@ -32,6 +35,8 @@ RUN arch="$(dpkg --print-architecture)" \ \ && wget --progress=dot:giga -O msopenjdk.tar.gz "${jdkUrl}" \ && if [ "$TARGET_JAVA_VERSION" -gt 21 ]; then \ + # https://github.com/adoptium/temurin23-binaries/releases/download/jdk-23.0.1%2B11/OpenJDK23U-debugimage_x64_linux_hotspot_23.0.1_11.tar.gz.sha256.txt + # https://github.com/adoptium/temurin23-binaries/releases/download/jdk-23.0.1%2B11/OpenJDK23U-debugimage_aarch64_linux_hotspot_23.0.1_11.tar.gz.sha256.txt wget --progress=dot:giga -O jdk-${TARGET_JAVA_VERSION}_linux-${arch}_sha256 "${jdkUrl}.sha256"; \ else \ wget --progress=dot:giga -O jdk-${TARGET_JAVA_VERSION}_linux-${arch}_sha256sum.txt "${jdkUrl}.sha256sum.txt"; \