From bf5701b9590a5ec9dabdeda40bb69f5b10593f38 Mon Sep 17 00:00:00 2001 From: "Brian M. Long" <brian@inteligr8.com> Date: Tue, 5 Sep 2023 15:34:38 -0400 Subject: [PATCH] TravaOpenJDK to Jetbrains JBR for jdk17 support --- Dockerfile | 19 ++++++++++--------- README.md | 2 +- docker-entrypoint.sh | 2 +- pom.xml | 24 ++++++++++-------------- setenv.sh | 2 +- 5 files changed, 23 insertions(+), 26 deletions(-) diff --git a/Dockerfile b/Dockerfile index db87393..b2dd22e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,8 +4,8 @@ FROM ubuntu:${ubuntu.version} # Configure standard JAVA parameters ENV JAVA_MEMORY_INIT=128m ENV JAVA_MEMORY_MAX=512m -ENV JAVA_HOME=/usr/local/lib/jvm/java-openjdk-dcevm -ENV JRE_HOME=/usr/local/lib/jvm/java-openjdk-dcevm +ENV JAVA_HOME=/usr/local/lib/jvm/java-openjdk-jbr +ENV JRE_HOME=/usr/local/lib/jvm/java-openjdk-jbr ENV JAVA_OPTS= ENV ENABLE_HOTSWAP=true ENV ENABLE_JDWP=true @@ -15,16 +15,17 @@ ENV DISABLE_HOTSWAP_PLUGINS= RUN apt update && \ apt -y install curl -# Download & Install DCEVM Java +# Download & Install JBR Java RUN mkdir -p /usr/local/lib/jvm && \ - curl -L https://github.com/TravaOpenJDK/trava-jdk-${dcevm.majorVersion}-dcevm/releases/download/dcevm-${dcevm.version}/${dcevm.filename} -o /usr/local/lib/jvm/java-openjdk-dcevm.tar.gz && \ + curl -L https://cache-redirector.jetbrains.com/intellij-jbr/${jbr.filename} -o /usr/local/lib/jvm/java-openjdk-jbr.tar.gz && \ cd /usr/local/lib/jvm && \ - tar xzvf java-openjdk-dcevm.tar.gz && \ - mv dcevm-${dcevm.version} java-openjdk-dcevm && \ - rm java-openjdk-dcevm.tar.gz + tar xzvf java-openjdk-jbr.tar.gz && \ + mv ${jbr.basename} java-openjdk-jbr && \ + mkdir -p java-openjdk-jbr/lib/hotswap && \ + rm java-openjdk-jbr.tar.gz # Download Hotswap Agent -RUN curl -L https://github.com/HotswapProjects/HotswapAgent/releases/download/RELEASE-${hotswap.version}/hotswap-agent-${hotswap.version}.jar -o /usr/local/lib/jvm/hotswap-agent.jar +RUN curl -L https://github.com/HotswapProjects/HotswapAgent/releases/download/RELEASE-${hotswap.version}/hotswap-agent-${hotswap.version}.jar -o /usr/local/lib/jvm/java-openjdk-jbr/lib/hotswap/hotswap-agent.jar # Add directories for dynamic injection points RUN mkdir -p /var/lib/jvm && cd /var/lib/jvm && \ @@ -33,7 +34,7 @@ RUN mkdir -p /var/lib/jvm && cd /var/lib/jvm && \ mkdir lib lib-extra1 lib-extra2 lib-extra3 lib-extra4 lib-extra5 lib-extra6 lib-extra7 # Add our Docker container initialization scripts -ADD maven/target/setenv.sh /usr/local/bin/${dcevm.prefix}-setenv.sh +ADD maven/target/setenv.sh /usr/local/bin/${namespace.prefix}-setenv.sh ADD maven/target/docker-entrypoint.sh /usr/local/bin RUN chmod 755 /usr/local/bin/docker-entrypoint.sh diff --git a/README.md b/README.md index 0b1adf5..044d0f1 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Java Application Container Image with Hot-Reloading -This project creates a Docker image that has uses both the [Trava DCEVM](http://dcevm.github.io/) and [Hotswap Agent](http://hotswapagent.org/) and the Java JDWP debugger. The combination of these utilities allows for the hot-reloading of Java resources and classes to enable rapid application development and debugging capabilties. As a Docker image, containers can be started to facilitate development without requiring complicated installations on developer workstations. +This project creates a Docker image that has uses both the [Jetbrains JDK](https://github.com/JetBrains/JetBrainsRuntime) and [Hotswap Agent](http://hotswapagent.org/) and the Java JDWP debugger. The combination of these utilities allows for the hot-reloading of Java resources and classes to enable rapid application development and debugging capabilties. As a Docker image, containers can be started to facilitate development without requiring complicated installations on developer workstations. It is expected that containers are configured in Maven using the Fabric8 or Spotify Docker plugins. These configurations should expose the 8000 (debugger) port and any other port that the application may open. Most importantly, it should mount/bind the source code to the following possible paths. diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index fe056d6..17bad74 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,5 +1,5 @@ #!/bin/sh -. /usr/local/bin/${dcevm.prefix}-setenv.sh +. /usr/local/bin/${namespace.prefix}-setenv.sh JAVA_CP="/var/lib/jvm/lib:/var/lib/jvm/lib/*" JAVA_CP="${JAVA_CP}:/var/lib/jvm/dev/classes:/var/lib/jvm/dev/classes-extra1:/var/lib/jvm/dev/classes-extra2:/var/lib/jvm/dev/classes-extra3:/var/lib/jvm/dev/classes-extra4:/var/lib/jvm/dev/classes-extra5:/var/lib/jvm/dev/classes-extra6:/var/lib/jvm/dev/classes-extra7" diff --git a/pom.xml b/pom.xml index 359c4dc..fedd808 100644 --- a/pom.xml +++ b/pom.xml @@ -2,32 +2,28 @@ <modelVersion>4.0.0</modelVersion> <groupId>com.inteligr8</groupId> - <artifactId>java-dcevm-hotswap</artifactId> - <version>11.0.15-1.4.1</version> - <name>Java DCEVM for Rapid Application Development</name> + <artifactId>jdk-hotswap</artifactId> + <version>1.4.1-jbr-17.0.8</version> + <name>Java Hotswap Kit for Rapid Application Development</name> <packaging>pom</packaging> <properties> <!-- The release version of Ubuntu to use as the base --> <!-- See: https://hub.docker.com/_/ubuntu --> <!-- This has very little impact and may be replaced --> - <ubuntu.version>20.04</ubuntu.version> - <dcevm.prefix>${project.artifactId}</dcevm.prefix> + <ubuntu.version>23.04</ubuntu.version> - <!-- The version of Java DCEVM to use for executing Apache Tomcat --> - <!-- See: https://github.com/TravaOpenJDK/trava-jdk-11-dcevm/releases --> - <dcevm.version>11.0.15+1</dcevm.version> - <dcevm.majorVersion>11</dcevm.majorVersion> - <dcevm.os-arch>linux-x64</dcevm.os-arch> - <!-- v11.0.10 - <dcevm.filename>java${dcevm.majorVersion}-openjdk-dcevm-${dcevm.os-arch}.tar.gz</dcevm.filename> - --> - <dcevm.filename>Openjdk${dcevm.majorVersion}u-dcevm-${dcevm.os-arch}.tar.gz</dcevm.filename> + <namespace.prefix>${project.artifactId}</namespace.prefix> <!-- The version of the Hotswap Agent to use --> <!-- See: https://github.com/HotswapProjects/HotswapAgent/releases --> <hotswap.version>1.4.1</hotswap.version> + <jbr.version>17.0.8</jbr.version> + <jbr.buildNumber>1000.22</jbr.buildNumber> + <jbr.basename>jbr_jcef-${jbr.version}-linux-x64-b${jbr.buildNumber}</jbr.basename> + <jbr.filename>${jbr.basename}.tar.gz</jbr.filename> + <!-- The Docker image meta-data for pushing the build --> <image.name>inteligr8/${project.artifactId}</image.name> <image.tag>${project.version}</image.tag> diff --git a/setenv.sh b/setenv.sh index 3d0591c..b4257c6 100644 --- a/setenv.sh +++ b/setenv.sh @@ -2,7 +2,7 @@ JAVA_OPTS="${JAVA_OPTS} -Xms${JAVA_MEMORY_INIT} -Xmx${JAVA_MEMORY_MAX}" if [ "${ENABLE_HOTSWAP}" = "true" ]; then - JAVA_OPTS="${JAVA_OPTS} -XX:HotswapAgent=external -javaagent:/usr/local/lib/jvm/hotswap-agent.jar" + JAVA_OPTS="${JAVA_OPTS} -XX:+AllowEnhancedClassRedefinition -XX:HotswapAgent=fatjar" JAVA_OPTS="${JAVA_OPTS} -Dhotswap.disablePlugins=${DISABLE_HOTSWAP_PLUGINS}" fi