It’s good to be able to build Docker images directly from artifacts (JAR, WAR etc.) produced by Maven builds. One useful tool is the Spotify Docker Maven plugin which can help with this
This example (available on Github)
- uses Jersey Grizzly connector to build a simple REST app
- packages this as a (Uber) JAR using Maven
- the maven build process pushes this as a Docker image (thanks to the plugin)
The pom.xml itself incorporates the Docker related configuration which is generally encapsulated in a Dockerfile (this mode is supported by the plugin as well). Here is a snippet..
Hope this gives you a simple yet useful starting point
Cheers!