From d2a33a028dac3b7a1c73b1577528c8701b9fb8b7 Mon Sep 17 00:00:00 2001 From: Brian Long Date: Mon, 15 Mar 2021 14:37:43 -0400 Subject: [PATCH] added hotswap/dcevm --- Dockerfile | 29 +++++++++++++++++++++++------ hotswap-agent.properties | 6 +++--- pom.xml | 28 +++++++++++++++++++++++----- 3 files changed, 49 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6420be1..e5e69d8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,7 @@ FROM ubuntu:${ubuntu.version} -RUN apt update -RUN apt -y install openjdk-${java.majorVersion}-jdk -RUN apt -y install tomcat${tomcat.majorVersion} - +# Configure the Apache Tomcat Catalina script ENV JAVA_MEMORY_INIT=128m ENV JAVA_MEMORY_MAX=512m ENV JAVA_HOME="/usr/lib/jvm/java-${java.majorVersion}-openjdk-amd64" @@ -12,12 +9,23 @@ ENV CATALINA_HOME="/usr/share/tomcat${tomcat.majorVersion}" ENV CATALINA_BASE="/var/lib/tomcat${tomcat.majorVersion}" ENV CATALINA_OPTS= +# Install the latest Apache Tomcat and its Java dependencies +RUN apt update && apt -y install curl && \ + apt -y install openjdk-${java.majorVersion}-jdk-headless && \ + apt -y install openjdk-${java.majorVersion}-jre-dcevm && \ + apt -y install tomcat${tomcat.majorVersion} && \ + cd /var/lib/tomcat${tomcat.majorVersion}/lib && \ + curl -OL https://github.com/HotswapProjects/HotswapAgent/releases/download/RELEASE-${hotswap.version}/hotswap-agent-${hotswap.version}.jar + +# Add our Docker container initialization script ADD docker-entrypoint.sh /usr/local/bin -# This will give us dynamic injection points into the running webapps +# Add our Apache Tomcat configuration +# This gives us dynamic injection points into the running webapps COPY tomcat-context.xml /etc/tomcat${tomcat.majorVersion}/context.xml +COPY hotswap-agent.properties /var/lib/tomcat${tomcat.majorVersion}/lib -# We need to create all possible mapped directories +# Add directories for dynamic injection points RUN cd /var/lib/tomcat${tomcat.majorVersion} && \ rm -rf webapps/ROOT* && \ mkdir dev && cd dev && \ @@ -25,8 +33,17 @@ RUN cd /var/lib/tomcat${tomcat.majorVersion} && \ mkdir lib lib-extra1 lib-extra2 lib-extra3 lib-extra4 lib-extra5 lib-extra6 lib-extra7 && \ mkdir web web-extra1 web-extra2 web-extra3 web-extra4 web-extra5 web-extra6 web-extra7 +# Listening for HTTP (not HTTPS) traffic EXPOSE 8080 + +# Listening for Java debugger traffic EXPOSE 8000 +# Running as ROOT user for now +#USER tomcat + +# Execute the Docker container initialization script ENTRYPOINT [ "/usr/local/bin/docker-entrypoint.sh" ] + +# Start the Apache Tomcat web container using the Catalina script CMD [ "/usr/share/tomcat${tomcat.majorVersion}/bin/catalina.sh", "run" ] diff --git a/hotswap-agent.properties b/hotswap-agent.properties index 558b0a2..c3992ec 100644 --- a/hotswap-agent.properties +++ b/hotswap-agent.properties @@ -19,14 +19,14 @@ extraClasspath=/var/lib/tomcat9/dev/classes # replacements of resources in a building step (maven filtering resource option). # This setting will leave i.e. src/target/classes as default source for resources, but after the resource is modified # in src/main/resources, the new changed resource is served instead. -watchResources= +watchResources=/var/lib/tomcat9/dev/classes # Load static web resources from different directory. # # This setting is dependent on application server plugin(Jetty, Tomcat, ...). # Jboss and Glassfish are not yet supported. # Use this setting to set to serve resources from source directory directly (e.g. src/main/webapp). -webappDir= +webappDir=/var/lib/tomcat9/dev/web # Comma separated list of disabled plugins @@ -54,7 +54,7 @@ autoHotswap=true # # You need to specify JPDA port at startup #
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000
-# autoHotswap.port=8000 +autoHotswap.port=8000 # Enables debugging in OsgiEquinox # osgiEquinox.debugMode=true diff --git a/pom.xml b/pom.xml index 8319877..5af81c5 100644 --- a/pom.xml +++ b/pom.xml @@ -3,21 +3,35 @@ 4.0.0 com.inteligr8 tomcat-rad - 9-1.1 + 9-1.2 Apache Tomcat for Rapid Application Development pom + + 20.04 - 11 + + + 1.4.1 + + 9 + + + + 11 + + inteligr8/${project.artifactId} ${project.version} docker.inteligr8.com + true + io.fabric8 fabric8-maven-plugin @@ -30,13 +44,17 @@ ${basedir} + docker + true + docker-build package build + docker-push deploy @@ -44,6 +62,7 @@ + maven-deploy-plugin @@ -55,10 +74,9 @@ - use-local-docker + no-docker - false - docker + true