Skip to content

Commit ee0d227

Browse files
Added Java 17 support
1 parent 285f98d commit ee0d227

3 files changed

Lines changed: 30 additions & 4 deletions

File tree

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 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 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: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def replace_cf_dependencies():
5656
symlink.linkname = destination
5757
tar.addfile(symlink)
5858

59-
# Only JDK 11 is supported by Docker Buildpack
59+
# JDK 11 support by Docker Buildpack
6060
jdk_dependency = get_dependency("java.11-jdk", "/opt/mendix/buildpack")
6161
logging.debug("Creating symlink for jdk {0}".format(jdk_dependency['artifact']))
6262
jdk_cache_artifact = f"/tmp/buildcache/bust/{jdk_dependency['artifact']}"
@@ -69,7 +69,20 @@ def replace_cf_dependencies():
6969
symlink.linkname = f"{jdk_destination}/{jdk_dir}"
7070
tar.addfile(symlink)
7171

72-
# Only JRE 11 is supported by Docker Buildpack
72+
# JDK 17 support by Docker Buildpack
73+
jdk_dependency = get_dependency("java.17-jdk", "/opt/mendix/buildpack")
74+
logging.debug("Creating symlink for jdk {0}".format(jdk_dependency['artifact']))
75+
jdk_cache_artifact = f"/tmp/buildcache/bust/{jdk_dependency['artifact']}"
76+
jdk_destination = '/etc/alternatives/java_sdk_17'
77+
with tarfile.open(jdk_cache_artifact, "w:gz") as tar:
78+
# Symlinks to use jdk from host OS
79+
for jdk_dir in os.listdir(jdk_destination):
80+
symlink = tarfile.TarInfo(f"jdk/{jdk_dir}")
81+
symlink.type = tarfile.SYMTYPE
82+
symlink.linkname = f"{jdk_destination}/{jdk_dir}"
83+
tar.addfile(symlink)
84+
85+
# JRE 11 support by Docker Buildpack
7386
jre_dependency = get_dependency("java.11-jre", "/opt/mendix/buildpack")
7487
logging.debug("Creating symlink for jre {0}".format(jre_dependency['artifact']))
7588
jre_cache_artifact = f"/tmp/buildcache/bust/{jre_dependency['artifact']}"
@@ -82,6 +95,19 @@ def replace_cf_dependencies():
8295
symlink.linkname = f"{jre_destination}/{jre_dir}"
8396
tar.addfile(symlink)
8497

98+
# JRE 17 support by Docker Buildpack
99+
jre_dependency = get_dependency("java.17-jre", "/opt/mendix/buildpack")
100+
logging.debug("Creating symlink for jre {0}".format(jre_dependency['artifact']))
101+
jre_cache_artifact = f"/tmp/buildcache/bust/{jre_dependency['artifact']}"
102+
jre_destination = '/etc/alternatives/jre_17'
103+
with tarfile.open(jre_cache_artifact, "w:gz") as tar:
104+
# Symlinks to use jre from host OS
105+
for jre_dir in os.listdir(jre_destination):
106+
symlink = tarfile.TarInfo(f"jre/{jre_dir}")
107+
symlink.type = tarfile.SYMTYPE
108+
symlink.linkname = f"{jre_destination}/{jre_dir}"
109+
tar.addfile(symlink)
110+
85111
def call_buildpack_compilation():
86112
logging.debug("Executing call_buildpack_compilation...")
87113
return runpy.run_module("buildpack.stage", run_name="__main__")

0 commit comments

Comments
 (0)