Skip to content

Commit

Permalink
Merge pull request #196 from GiriChandana123/DES-5564_support_for_new…
Browse files Browse the repository at this point in the history
…er_java_versions

DES-5564-support for newer java versions
  • Loading branch information
zlogic authored May 28, 2024
2 parents 285f98d + 1b7c219 commit 1564030
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion rootfs-app.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ENV LC_ALL C.UTF-8
# install dependencies & remove package lists
RUN microdnf update -y && \
microdnf module enable nginx:1.20 -y && \
microdnf install -y glibc-langpack-en python311 openssl nginx nginx-mod-stream java-11-openjdk-headless tzdata-java fontconfig binutils && \
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 && \
microdnf clean all && rm -rf /var/cache/yum

# Set nginx permissions
Expand Down
2 changes: 1 addition & 1 deletion rootfs-builder.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ RUN rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.
microdnf clean all && rm -rf /var/cache/yum

# Install RHEL alternatives to CF Buildpack dependencies
RUN microdnf install -y java-11-openjdk-headless java-11-openjdk-devel tzdata-java mono-core-5.20.1.34 libgdiplus0 libicu && \
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 && \
microdnf clean all && rm -rf /var/cache/yum

# Set nginx permissions
Expand Down
24 changes: 17 additions & 7 deletions scripts/compilation.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,19 @@ def replace_cf_dependencies():
symlink.type = tarfile.SYMTYPE
symlink.linkname = destination
tar.addfile(symlink)

# Only JDK 11 is supported by Docker Buildpack
jdk_dependency = get_dependency("java.11-jdk", "/opt/mendix/buildpack")
get_jdk_dependency("java.11-jdk","java_sdk_11")
get_jdk_dependency("java.17-jdk","java_sdk_17")
get_jdk_dependency("java.21-jdk","java_sdk_21")
get_jre_dependency("java.11-jre","jre_11")
get_jre_dependency("java.17-jre","jre_17")
get_jre_dependency("java.21-jre","jre_21")

# JDK 11, 17, 21 support by Docker Buildpack
def get_jdk_dependency(jdk_version, jdk_destination_version):
jdk_dependency = get_dependency(jdk_version, "/opt/mendix/buildpack")
logging.debug("Creating symlink for jdk {0}".format(jdk_dependency['artifact']))
jdk_cache_artifact = f"/tmp/buildcache/bust/{jdk_dependency['artifact']}"
jdk_destination = '/etc/alternatives/java_sdk_11'
jdk_destination = '/etc/alternatives/'+jdk_destination_version
with tarfile.open(jdk_cache_artifact, "w:gz") as tar:
# Symlinks to use jdk from host OS
for jdk_dir in os.listdir(jdk_destination):
Expand All @@ -69,11 +76,13 @@ def replace_cf_dependencies():
symlink.linkname = f"{jdk_destination}/{jdk_dir}"
tar.addfile(symlink)

# Only JRE 11 is supported by Docker Buildpack
jre_dependency = get_dependency("java.11-jre", "/opt/mendix/buildpack")

# JRE 11, 17, 21 support by Docker Buildpack
def get_jre_dependency(jre_version, jre_destination_version):
jre_dependency = get_dependency(jre_version, "/opt/mendix/buildpack")
logging.debug("Creating symlink for jre {0}".format(jre_dependency['artifact']))
jre_cache_artifact = f"/tmp/buildcache/bust/{jre_dependency['artifact']}"
jre_destination = '/etc/alternatives/jre_11'
jre_destination = '/etc/alternatives/'+jre_destination_version
with tarfile.open(jre_cache_artifact, "w:gz") as tar:
# Symlinks to use jre from host OS
for jre_dir in os.listdir(jre_destination):
Expand All @@ -82,6 +91,7 @@ def replace_cf_dependencies():
symlink.linkname = f"{jre_destination}/{jre_dir}"
tar.addfile(symlink)


def call_buildpack_compilation():
logging.debug("Executing call_buildpack_compilation...")
return runpy.run_module("buildpack.stage", run_name="__main__")
Expand Down

0 comments on commit 1564030

Please sign in to comment.