The steps for this recipe are as follows:
- First, open our message-service project from the previous chapters. Create a new file in the root of the project called Dockerfile:
FROM openjdk:8-jdk-alpineVOLUME /tmpEXPOSE 8082ARG JAR_FILE=build/libs/message-service-1.0-SNAPSHOT.jarADD ${JAR_FILE} app.jarENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
- The Dockerfile file defines the base image that we'll use to build our message-service image. In this case, we're basing our image off of an Alpine Linux image with OpenJDK 8. Next, we expose the port that our service binds to and define how to run our service after it's packaged as a JAR file. We're now ready to use the Dockerfile file to build an ...