Skip to content

[AURON #2024] Support multi-JDK versions in Docker images.#2025

Open
slfan1989 wants to merge 1 commit intoapache:masterfrom
slfan1989:auron-2024
Open

[AURON #2024] Support multi-JDK versions in Docker images.#2025
slfan1989 wants to merge 1 commit intoapache:masterfrom
slfan1989:auron-2024

Conversation

@slfan1989
Copy link
Contributor

Which issue does this PR close?

Closes #2024

Rationale for this change

JDK 8 and JDK 11 have reached End of Life (EOL), and our Docker build environments currently use inconsistent JDK versions and installation methods across different Linux distributions. This PR addresses these issues by:

  1. Preparing for JDK migration: Enable testing and migration to actively supported JDK versions (17/21 LTS)
  2. Unifying JDK installation: Standardize to Eclipse Temurin binaries across all platforms, removing dependency on distribution-specific package managers
  3. Improving flexibility: Support multiple JDK versions in a single image without rebuilding
  4. Reducing security risks: Provide clear path away from EOL software while maintaining backward compatibility

What changes are included in this PR?

Core Changes

Unified multi-JDK support across all 5 Docker build images:

  • dev/docker-build/ubuntu24/Dockerfile
  • dev/docker-build/debian11/Dockerfile
  • dev/docker-build/centos7/Dockerfile
  • dev/docker-build/rockylinux8/Dockerfile
  • dev/docker-build/azurelinux3/Dockerfile

Are there any user-facing changes?

None - Default behavior (JDK 8) remains unchanged.

How was this patch tested?

Exists CI.

Signed-off-by: slfan1989 <slfan1989@apache.org>
# NOTE: JDK 8 and JDK 11 are EOL. Prefer JDK 17+ for new usage.
# ---------------------------------------------------------------------
ARG JDK_VERSIONS="8 11 17 21"
ARG DEFAULT_JDK="8"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why the default is still JDK 8?

Comment on lines +69 to +86
ARG DEFAULT_JDK="8"
ENV JAVA_INSTALL_BASE="/opt/java"
RUN set -eux; \
mkdir -p "${JAVA_INSTALL_BASE}"; \
for v in ${JDK_VERSIONS}; do \
url="https://github.com/adoptium/temurin${v}-binaries/releases/latest/download/OpenJDK${v}U-jdk_x64_linux_hotspot.tar.gz"; \
curl -fsSL "$url" -o /tmp/temurin.tar.gz || { echo "Failed to download JDK ${v}"; exit 1; }; \
mkdir -p "${JAVA_INSTALL_BASE}/temurin-${v}"; \
tar -xzf /tmp/temurin.tar.gz -C "${JAVA_INSTALL_BASE}/temurin-${v}" --strip-components=1; \
done; \
rm -f /tmp/temurin.tar.gz; \
alt="$(command -v update-alternatives || command -v alternatives)"; \
for v in ${JDK_VERSIONS}; do \
"$alt" --install /usr/bin/java java "${JAVA_INSTALL_BASE}/temurin-${v}/bin/java" $((100 + v)); \
"$alt" --install /usr/bin/javac javac "${JAVA_INSTALL_BASE}/temurin-${v}/bin/javac" $((100 + v)); \
done; \
"$alt" --set java "${JAVA_INSTALL_BASE}/temurin-${DEFAULT_JDK}/bin/java"; \
"$alt" --set javac "${JAVA_INSTALL_BASE}/temurin-${DEFAULT_JDK}/bin/javac"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This patterns seems like it would bloat the base image quite a bit. Why not, either

  1. let the callers pass in a build arg like so
  2. or have different docker files per jdk version (seems like common practice)

ENV PATH="/root/.cargo/bin:${PATH}"

# ---------------------------------------------------------------------
# Install Java (Microsoft OpenJDK 17 - matches Azure Synapse Spark pools)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would still want to install Microsoft OpenJDK based java versions for azurelinux, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUILD] Support multi-JDK versions in Docker images

2 participants