Skip to content

Commit 1564030

Browse files
authored
Merge pull request #196 from GiriChandana123/DES-5564_support_for_newer_java_versions
DES-5564-support for newer java versions
2 parents 285f98d + 1b7c219 commit 1564030

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

rootfs-app.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ENV LC_ALL C.UTF-8
1212
# install dependencies & remove package lists
1313
RUN microdnf update -y && \
1414
microdnf module enable nginx:1.20 -y && \
15-
microdnf install -y glibc-langpack-en python311 openssl nginx nginx-mod-stream java-11-openjdk-headless tzdata-java fontconfig binutils && \
15+
microdnf install -y glibc-langpack-en python311 openssl nginx nginx-mod-stream java-11-openjdk-headless java-17-openjdk-headless java-21-openjdk-headless tzdata-java fontconfig binutils && \
1616
microdnf clean all && rm -rf /var/cache/yum
1717

1818
# Set nginx permissions

rootfs-builder.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ RUN rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.
3333
microdnf clean all && rm -rf /var/cache/yum
3434

3535
# Install RHEL alternatives to CF Buildpack dependencies
36-
RUN microdnf install -y java-11-openjdk-headless java-11-openjdk-devel tzdata-java mono-core-5.20.1.34 libgdiplus0 libicu && \
36+
RUN microdnf install -y java-11-openjdk-headless java-11-openjdk-devel java-17-openjdk-headless java-17-openjdk-devel java-21-openjdk-headless java-21-openjdk-devel tzdata-java mono-core-5.20.1.34 libgdiplus0 libicu && \
3737
microdnf clean all && rm -rf /var/cache/yum
3838

3939
# Set nginx permissions

scripts/compilation.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,19 @@ def replace_cf_dependencies():
5555
symlink.type = tarfile.SYMTYPE
5656
symlink.linkname = destination
5757
tar.addfile(symlink)
58-
59-
# Only JDK 11 is supported by Docker Buildpack
60-
jdk_dependency = get_dependency("java.11-jdk", "/opt/mendix/buildpack")
58+
get_jdk_dependency("java.11-jdk","java_sdk_11")
59+
get_jdk_dependency("java.17-jdk","java_sdk_17")
60+
get_jdk_dependency("java.21-jdk","java_sdk_21")
61+
get_jre_dependency("java.11-jre","jre_11")
62+
get_jre_dependency("java.17-jre","jre_17")
63+
get_jre_dependency("java.21-jre","jre_21")
64+
65+
# JDK 11, 17, 21 support by Docker Buildpack
66+
def get_jdk_dependency(jdk_version, jdk_destination_version):
67+
jdk_dependency = get_dependency(jdk_version, "/opt/mendix/buildpack")
6168
logging.debug("Creating symlink for jdk {0}".format(jdk_dependency['artifact']))
6269
jdk_cache_artifact = f"/tmp/buildcache/bust/{jdk_dependency['artifact']}"
63-
jdk_destination = '/etc/alternatives/java_sdk_11'
70+
jdk_destination = '/etc/alternatives/'+jdk_destination_version
6471
with tarfile.open(jdk_cache_artifact, "w:gz") as tar:
6572
# Symlinks to use jdk from host OS
6673
for jdk_dir in os.listdir(jdk_destination):
@@ -69,11 +76,13 @@ def replace_cf_dependencies():
6976
symlink.linkname = f"{jdk_destination}/{jdk_dir}"
7077
tar.addfile(symlink)
7178

72-
# Only JRE 11 is supported by Docker Buildpack
73-
jre_dependency = get_dependency("java.11-jre", "/opt/mendix/buildpack")
79+
80+
# JRE 11, 17, 21 support by Docker Buildpack
81+
def get_jre_dependency(jre_version, jre_destination_version):
82+
jre_dependency = get_dependency(jre_version, "/opt/mendix/buildpack")
7483
logging.debug("Creating symlink for jre {0}".format(jre_dependency['artifact']))
7584
jre_cache_artifact = f"/tmp/buildcache/bust/{jre_dependency['artifact']}"
76-
jre_destination = '/etc/alternatives/jre_11'
85+
jre_destination = '/etc/alternatives/'+jre_destination_version
7786
with tarfile.open(jre_cache_artifact, "w:gz") as tar:
7887
# Symlinks to use jre from host OS
7988
for jre_dir in os.listdir(jre_destination):
@@ -82,6 +91,7 @@ def replace_cf_dependencies():
8291
symlink.linkname = f"{jre_destination}/{jre_dir}"
8392
tar.addfile(symlink)
8493

94+
8595
def call_buildpack_compilation():
8696
logging.debug("Executing call_buildpack_compilation...")
8797
return runpy.run_module("buildpack.stage", run_name="__main__")

0 commit comments

Comments
 (0)