Creating a Docker Image

A Docker image is defined by a Dockerfile, which is a text document containing instructions Docker follows as it provisions a new container. To create a Docker image for your WAR file, you must create a Dockerfile in the project.

To begin, move into the root directory of the stock-service application you implemented in Chapter 1, Getting Started with JRuby.

 $ ​​cd​​ ​​~/code/stock-service

Then create a Dockerfile in that directory and put the following code in it:

 FROM heroku/jvm
 
 ADD ./stock-service.war /app/user/

This defines an image that inherits from the heroku/jvm image. It then tells Docker to add the WAR file from the local machine to the /app/user directory ...

Get Deploying with JRuby 9k now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.