Skip to content

Commit 3ffd13d

Browse files
committed
feat(java): make Java 21 default
1 parent 6bfd07f commit 3ffd13d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

java/lts/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ LABEL org.opencontainers.image.licenses=MIT
77

88
ENV DEBIAN_FRONTEND="noninteractive"
99

10+
ARG TARGETARCH
11+
1012
# Install required packages and Temurin Java LTS versions
1113
RUN set -eux; \
1214
apt-get update; \
@@ -19,5 +21,16 @@ RUN set -eux; \
1921
apt-get update; \
2022
apt-get install -o APT::Keep-Downloaded-Packages="false" -y \
2123
temurin-8-jdk temurin-11-jdk temurin-17-jdk temurin-21-jdk temurin-25-jdk; \
24+
# Set Java 21 as the default version
25+
case "${TARGETARCH}" in \
26+
amd64) \
27+
update-alternatives --set java /usr/lib/jvm/temurin-21-jdk-amd64/bin/java; \
28+
update-alternatives --set javac /usr/lib/jvm/temurin-21-jdk-amd64/bin/javac; \
29+
;; \
30+
arm64) \
31+
update-alternatives --set java /usr/lib/jvm/temurin-21-jdk-arm64/bin/java; \
32+
update-alternatives --set javac /usr/lib/jvm/temurin-21-jdk-arm64/bin/javac; \
33+
;; \
34+
esac; \
2235
apt-get clean; \
2336
rm -rf /var/lib/apt/lists/*

0 commit comments

Comments
 (0)