Simple sample: Dockerized Java app using a maven plugin

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..

pom-for-spotify-docker-maven-plugin

Hope this gives you a simple yet useful starting point

Cheers!

 

Advertisements

About Abhishek

Java EE & distributed systems junkie who frequently blogs at abhirockzz.wordpress.com as well as simplydistributed.wordpress.com. Oh, I have also authored a few (mini) books, articles, Refcards etc. :-)
This entry was posted in Docker, Java and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s