container_java_21.diff
| new/base_ubuntu/repo/switch-java.sh 2025-06-20 09:14:14 +0000 | ||
|---|---|---|
| 1 | 1 |
#!/bin/bash |
| 2 | 2 | |
| 3 |
if [ "$JDK_VERSION" == "17" ]; then |
|
| 3 |
if [ "$JDK_VERSION" == "21" ]; then |
|
| 4 |
update-alternatives --quiet --set java /usr/lib/jvm/java-21-openjdk-amd64/bin/java |
|
| 5 |
update-alternatives --quiet --set javac /usr/lib/jvm/java-21-openjdk-amd64/bin/javac |
|
| 6 |
# configure JNI linking - https://proj.goldencode.com/projects/p2j/wiki/Configure_JNI_Linking |
|
| 7 |
[ -L "/usr/lib/libjvm.so" ] && rm /usr/lib/libjvm.so |
|
| 8 |
ln -s /usr/lib/jvm/java-21-openjdk-amd64/lib/server/libjvm.so /usr/lib/libjvm.so |
|
| 9 |
echo "Setup JDK 21" > /tmp/switch-java.log |
|
| 10 |
elif [ "$JDK_VERSION" == "17" ]; then |
|
| 4 | 11 |
update-alternatives --quiet --set java /usr/lib/jvm/java-17-openjdk-amd64/bin/java |
| 5 | 12 |
update-alternatives --quiet --set javac /usr/lib/jvm/java-17-openjdk-amd64/bin/javac |
| 6 | 13 |
# configure JNI linking - https://proj.goldencode.com/projects/p2j/wiki/Configure_JNI_Linking |
| new/base_ubuntu_22.04_Dockerfile 2025-06-20 09:12:23 +0000 | ||
|---|---|---|
| 50 | 50 |
# contain 1000:1000 already so we need to update, not create. |
| 51 | 51 |
# RFB 20250610 The timezone handling needed to be updated to the 24.04 method. |
| 52 | 52 |
# RFB 20250618 Some further refinements to make sure we are utilizing the correct version. |
| 53 |
|
|
| 53 |
# TJD 20250620 Support for Java 21 |
|
| 54 | 54 |
# This program is free software: you can redistribute it and/or modify |
| 55 | 55 |
# it under the terms of the GNU Affero General Public License as |
| 56 | 56 |
# published by the Free Software Foundation, either version 3 of the |
| ... | ... | |
| 117 | 117 |
ARG TZDATA_AREA=America |
| 118 | 118 |
ARG TZDATA_ZONE=New_York |
| 119 | 119 |
ARG BASE_OS_TOOLS="build-essential apt-utils wget curl dos2unix gcc jq locales sudo unzip vim zip bzr python3-paramiko openssh-server openssh-client gosu iproute2 iputils-ping dnsutils iproute2 rsync less p7zip-full screen" |
| 120 |
ARG JDK_INSTALL="openjdk-8-jdk openjdk-8-source openjdk-17-jdk openjdk-17-source" |
|
| 120 |
ARG JDK_INSTALL="openjdk-8-jdk openjdk-8-source openjdk-17-jdk openjdk-17-source openjdk-21-jdk openjdk-21-source"
|
|
| 121 | 121 |
ARG RUNTIME_TOOLS="dpkg-dev libffi-dev libncurses5-dev ncurses-term ant libpam0g-dev" |
| 122 | 122 |
ARG FWD_UID=1000 |
| 123 | 123 |
ARG FWD_GID=1000 |
| ... | ... | |
| 230 | 230 |
RUN update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-8-openjdk-amd64/bin/java 1081 && \ |
| 231 | 231 |
update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-8-openjdk-amd64/bin/javac 1081 && \ |
| 232 | 232 |
update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-17-openjdk-amd64/bin/java 1082 && \ |
| 233 |
update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-17-openjdk-amd64/bin/javac 1082 |
|
| 233 |
update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-17-openjdk-amd64/bin/javac 1082 && \ |
|
| 234 |
update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-21-openjdk-amd64/bin/java 1083 && \ |
|
| 235 |
update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-21-openjdk-amd64/bin/javac 1083 |
|
| 234 | 236 |
|
| 235 | 237 |
# Step 14/33 |
| 236 | 238 |
COPY java_admin /etc/sudoers.d/ |
| new/build_base_ubuntu.sh 2025-06-20 11:30:03 +0000 | ||
|---|---|---|
| 80 | 80 |
tzdata_area_value_def="America" |
| 81 | 81 |
tzdata_zone_value_def="New_York" |
| 82 | 82 |
base_os_tools_def="build-essential apt-utils wget curl dos2unix gcc jq locales sudo unzip vim zip bzr python3-paramiko openssh-server openssh-client gosu iproute2 iputils-ping dnsutils iproute2 rsync less p7zip-full screen" |
| 83 |
jdk_install_def="openjdk-8-jdk openjdk-8-source openjdk-17-jdk openjdk-17-source" |
|
| 83 |
jdk_install_def="openjdk-8-jdk openjdk-8-source openjdk-17-jdk openjdk-17-source openjdk-21-jdk openjdk-21-source"
|
|
| 84 | 84 |
runtime_tools_def="dpkg-dev libffi-dev libncurses5-dev ncurses-term ant libpam0g-dev" |
| 85 | 85 |
fwd_uid_def=1000 |
| 86 | 86 |
fwd_gid_def=1000 |
| ... | ... | |
| 189 | 189 |
echo "Performing: $cmd" |
| 190 | 190 |
eval $cmd |
| 191 | 191 | |
| 192 |
# Repeat, but set default JDK to 21 |
|
| 193 |
cmd="docker build $progress_plain $no_cache -t ${image_name}_jdk21:${image_tag} -f ${dockerfile} --build-arg JDK_VERSION=21 ${jdk_build_args} ${contextdir}"
|
|
| 194 |
[ "$dry_run" = true ] && cmd="echo $cmd" |
|
| 195 |
echo "Performing: $cmd" |
|
| 196 |
eval $cmd |
|
| 197 | ||
| 192 | 198 |
# Previous base Ubuntu images will be used to create PG14 versions via a template Dockerfile |
| 193 | 199 |
update_dockerfile $pg_dockerfile "" |
| 194 | 200 |
cmd="docker build $progress_plain $no_cache -t ${pg_image_name}:${image_tag} -f ${pg_dockerfile} ${build_args} ${contextdir}"
|
| ... | ... | |
| 202 | 208 |
echo "Performing: $cmd" |
| 203 | 209 |
eval $cmd |
| 204 | 210 | |
| 211 |
update_dockerfile $pg_dockerfile "_jdk21" |
|
| 212 |
cmd="docker build $progress_plain $no_cache -t ${pg_image_name}_jdk21:${image_tag} -f ${pg_dockerfile} ${build_args} ${contextdir}"
|
|
| 213 |
[ "$dry_run" = true ] && cmd="echo $cmd" |
|
| 214 |
echo "Performing: $cmd" |
|
| 215 |
eval $cmd |
|
| 216 | ||
| 205 | 217 |
# For the postgres and mariadb images, we use the context subdirectory we care about, to minimize the size |
| 206 | 218 |
cmd="docker build $progress_plain $no_cache -t ${postgres_image_name}:${image_tag} -f ${postgres_dockerfile} ${build_args} ${contextdir}"
|
| 207 | 219 |
[ "$dry_run" = true ] && cmd="echo $cmd" |