Public | Automated Build

Last pushed: 2 years ago
Short Description
Short description is empty for this repo.
Full Description

Dockerfile prepared for microservices in java

This Dockerfile was created for running a java-process with a bias towards Dropwizard.

Assumptions made by this Dockerfile:

  • a Maven project
  • pom.xml file in the same dir
  • docker-config.yml file in same dir
  • file in same dir

The docker-config.yml will be renamed to config.yml in the /opt/$service_name directory.

The Dockerfile will upon building your child image execute a ONBUILD
statement that prepares the environment with the given settings.

This image is built on phusion/baseimage-docker. Go there for extensive
documentation on how the low-level stuff works.

The two/three variables needed here is service_name and repo_path.
The repo-path will point to a http(s) location
and download the jar-file with curl.
The variable service_version will also be available when the curl
command executes, so you can build a maven repo-path.
If your version ends with a -SNAPSHOT the variable snapshot_repo_path will be used place of repo_path.

NOTE: you can't use theese variables in your own build - as the are only set during one RUN instruction

Runtime variables

See the variables documentation from
phusion/baseimage-docker to see how it works.

This Dockerfile exposes these variables to the running image:


The service name is fetched from the file and made into a system variable. This is also the name of the process starting the microservice process.


The service version is made available from the pom.xml

Simply points to the /opt/$SERVICE_NAME/config.yml


This is default set to server, but can be overridden so that it can e.g migrate instead of server. If the command is set to anything else than server the service will run once during startup of container with this command. After successful return the SERVICE_CMD is rewritten to server and server starts normally.


This is set to a long list of default values, fetched and adapted form a
post in the dropwizard discussion groups.


This is a convenience variable, as you don't need to reiterate all JAVA_OPTIONS just to change the memory settings.


This variable is set at image build-time since it relies on the log-folder location.



#The version reference will be added by docker during build (from pom.xml)
#while referencing with ${service_name} works - the service name can be hardcoded here.


The Dockerfile will extract the project.version variable to get hold of the current version of the service and expose it
in a service_version variable while building the image, and set it to a SERVICE_VERSION variable available
at runtime.


This is your vanilla configuration file. It can be overridden by the use of volumes and SERVICE_OPTION variables.

Docker Pull Command
Source Repository