Public Repository

Last pushed: 7 months ago
Short Description
Java base image for self contained web apps with multiple env configurations.
Full Description

Supported tags and respective Dockerfile links

Features

  • Lightweight base image for self contained java web apps (in *-lw versions)
  • Multi environment support
  • NewRelic support
  • Tunning JVM by environment
  • Enable JMX by environment
  • Enable debugging by environment

Project structure

.
+-- pom.xml
+-- src
|   +-- ...
+-- conf
|   +-- common
|   |   +-- fooCommon.properties
|   +-- development
|   |   +-- logback.xml
|   |   +-- deploy-propeties.json
|   +-- staging
|   |   +-- logback.xml
|   |   +-- deploy-propeties.json
|   +-- production
|   |   +-- logback.xml
|   |   +-- deploy-propeties.json
|   +-- newrelic
|   |   +-- newrelic.yml

 

Put the deploy-properties.json file in each env directory


{
    "jvmArguments":"-Xms1024m -Xmx1024m",
    "debugEnabled": false,
    "jmxEnabled": true,
    "newRelicEnabled": true,
    "mainClass": "com.foo.App"
}

 

Used ports

  • 8080 for webApp
  • 9010 for debugging or jmx connections

 

Use the base image

FROM almundo/java:8-1.0.0

# Uncomment if you use newrelic
#COPY target/newrelic/newrelic.jar application/newrelic/newrelic.jar

COPY conf application/
COPY target/fooApp-fooVersion.jar application/fooApp-fooVersion.jar

 

docker build -t fooApp:fooVersion .

 

Run a container

 $ docker run -e ENV=development -e HOST_IP=fooIp -v /application --name fooApp -P  fooApp

 

Changing a reloadable configuration using freplace image

$ docker run --volumes-from fooApp almundo/freplace application/development https://foo.com/logback.xml
Docker Pull Command
Owner
almundo