The current dockerfile has a few problems that are easy to address:
It's a single-stage build that downloads Gradle at build time, resulting in a 958 MB Docker image even though the base image is 470 MB and the jar file produced by the build is 30 MB.
There's no convenient way of configuring the JVM options. The java -jar eiffel-gerrit-herald-1.0.0.jar command is in the CMD statement which is easily replaced to e.g. add -D and -Xmx JVM options, but then you add a dependency to the exact jar filename in the deployment configuration. We can improve this by adding support for an environment variable whose contents is included in the Java command.
Motivation
Reducing the size of the Docker image is obviously a good thing. Providing a standard method of passing JVM options reduces coupling between the source repository and the deployment configuration.
Exemplification
I want to be able to set system properties for the JVM. This is currently inconvenient.
Benefits
See Motivation.
Possible Drawbacks
None, except a slightly increased dockerfile complexity.
Description
The current dockerfile has a few problems that are easy to address:
java -jar eiffel-gerrit-herald-1.0.0.jar
command is in the CMD statement which is easily replaced to e.g. add-D
and-Xmx
JVM options, but then you add a dependency to the exact jar filename in the deployment configuration. We can improve this by adding support for an environment variable whose contents is included in the Java command.Motivation
Reducing the size of the Docker image is obviously a good thing. Providing a standard method of passing JVM options reduces coupling between the source repository and the deployment configuration.
Exemplification
I want to be able to set system properties for the JVM. This is currently inconvenient.
Benefits
See Motivation.
Possible Drawbacks
None, except a slightly increased dockerfile complexity.