Sign inSign up

francomorinigo/java-web-app

By francomorinigo

Updated over 9 years ago

Lightweight base image for self contained java web apps like spring boot apps.

Image
0

398

francomorinigo/java-web-app repository overview

Features
  • Lightweight base image for self contained java web apps
  • 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 francomorinigo/java-web-app:8-1.0.0

ARG version

# Uncomment if you use newrelic
# COPY target/newrelic/newrelic.jar application/newrelic/newrelic.jar
COPY conf application/
COPY target/fooApp-$version.jar application/fooApp-$version.jar

 

docker build -t fooApp:fooVersion . --build-arg version=fooVersion

 

Run a container

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

Tag summary

Content type

Image

Digest

Size

40.3 MB

Last updated

over 9 years ago

docker pull francomorinigo/java-web-app