added hotswap/dcevm

This commit is contained in:
Brian Long 2021-03-15 14:37:43 -04:00
parent e3d62b96b1
commit d2a33a028d
3 changed files with 49 additions and 14 deletions

View File

@ -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" ]

View File

@ -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
# <pre>java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000</pre>
# autoHotswap.port=8000
autoHotswap.port=8000
# Enables debugging in OsgiEquinox
# osgiEquinox.debugMode=true

28
pom.xml
View File

@ -3,21 +3,35 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.inteligr8</groupId>
<artifactId>tomcat-rad</artifactId>
<version>9-1.1</version>
<version>9-1.2</version>
<name>Apache Tomcat for Rapid Application Development</name>
<packaging>pom</packaging>
<properties>
<!-- The release version of Ubuntu to use as the base -->
<!-- This really only impacts what versions may be available for other components -->
<ubuntu.version>20.04</ubuntu.version>
<java.majorVersion>11</java.majorVersion>
<!-- The version of the hotswap agent to use -->
<hotswap.version>1.4.1</hotswap.version>
<!-- The major version of Apache Tomcat to serve as the basis of this Docker image -->
<tomcat.majorVersion>9</tomcat.majorVersion>
<!-- The major version of Java to use for executing Apache Tomcat -->
<!-- This version must have both the JDK/Headless and DCEVM packages -->
<java.majorVersion>11</java.majorVersion>
<!-- The Docker image meta-data for pushing the build -->
<image.name>inteligr8/${project.artifactId}</image.name>
<image.tag>${project.version}</image.tag>
<image.registry>docker.inteligr8.com</image.registry>
<docker.noCache>true</docker.noCache>
</properties>
<build>
<plugins>
<!-- This plugin build and pushes the Docker image -->
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
@ -30,13 +44,17 @@
</image>
</images>
<contextDir>${basedir}</contextDir>
<buildStrategy>docker</buildStrategy>
<verbose>true</verbose>
</configuration>
<executions>
<!-- This execution builds the Docker image -->
<execution>
<id>docker-build</id>
<phase>package</phase>
<goals><goal>build</goal></goals>
</execution>
<!-- This execution pushes the built Docker image to the configured Docker Registry -->
<execution>
<id>docker-push</id>
<phase>deploy</phase>
@ -44,6 +62,7 @@
</execution>
</executions>
</plugin>
<!-- This plugin prevents the project from deploying to the Maven Repository, as it is pointless -->
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
@ -55,10 +74,9 @@
<profiles>
<profile>
<id>use-local-docker</id>
<id>no-docker</id>
<properties>
<fabric8.build.jib>false</fabric8.build.jib>
<fabric8.build.strategy>docker</fabric8.build.strategy>
<fabric8.build.jib>true</fabric8.build.jib>
</properties>
</profile>
</profiles>