Java Magazine, Mar/Apr 2018
ORACLE COM JAVAMAGAZINE MARCH APRIL 2018 27 microservices and containers ENV DB_ USER acmeuser ENV DB_ PASSWORD yourpassword Adds an application COPY EmployeeService 10 war opt payara deployments Default command to execute ENTRYPOINT java jar opt payara payara micro jar addJars opt payara deployments database connector jar deploy opt payara deployments EmployeeService 10 war To begin writing a Dockerfile simply create a file named Dockerfile with no extension within a directory where you will place any required files to be loaded A Dockerfile generally consists of one or more instructions for building a Docker image The first instruction must be a FROM instruction specifying the base image from which to build In this case I am building from the Payara Micro 5 base so I use this FROM payara micro 5 SNAPSHOT Next it is a good idea to indicate the maintainer of the file using the MAINTAINER instruction The next instruction RUN in this example obtains the Apache Derby JAR file and copies it into a JAR file in the opt payara deployments directory of the image Following that a few environment variables are specified for connecting to the database in the host environment using the configurations that were placed within the web xml file It is worth noting that this Dockerfile is set up for use on an Apple Mac running Docker for Mac because the environment variable for the host machine is specified for a Mac If you are deploying to a diferent OS host modify the host IP address accordingly
You must have JavaScript enabled to view digital editions.