Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note
titlePrerequisites

In addition to a Dockerfile, the following files are required to build the Docker image:

  • myapp.war - a deployable archive of the desired web application, e.g., webapp.war, collaborator.war, or admin.war.
  • <install_root>/WebAppPlatform/shared/conf/logback.xml - the logging configuration file. To learn how to configure data logging, see Configuring data logging.
  • <install_root>/WebAppPlatform/shared/conf/webappplatform.properties - the file with Web Application Platform configuration properties.
  • you You may also need additional files, like email or document export templates that need to be copied to the web container.

...


Instructions in the Dockerfile may be written in several ways depending on your particular needs and preferences. The table below lists script statements you can use with descriptions and the indication whether the script part is required or optional.

Script statementRequired or optionalDescription

FROM tomcat:9-jdk17-openjdk

Required

In the FROM part where the base image needs to be specified, Tomcat should be selected as the base image and its version has to be compatible with the version of the web application code.

ARG TOMCAT_HOME=/usr/local/tomcat

Optional

An argument that is used as an intermediary variable to store the Tomcat home location. The location may be different depending on a particular base image used in the FROM part. This argument is introduced for convenience since further instructions reference the Tomcat home location multiple times.

COPY logback.xml ${TOMCAT_HOME}/shared/conf/

Optional (recommended)

Since Web Application Platform uses logback as the logging framework, there should be its configuration file available in the classpath. This command copies the logging configuration into the folder that will be included in the classpath.

Note that it is possible to use other names for the configuration file. In this case, the script should be updated to reference another file. It is possible to omit the configuration file but it is not recommended.

COPY webappplatform.properties ${TOMCAT_HOME}/shared/conf/

Optional

This command copies the properties file to the folder that is present in the classpath. If it is not copied, then an alternative solution must be used to reference the properties file. To learn about alternative options, see Passing properties.

COPY myapp.war ${TOMCAT_HOME}/webapps/

Required

This command copies the web application to the Tomcat deployment folder.

Note that you can put multiple web applications in same docker image. To do that, add a separate command for each .war file.

RUN sed -i "s|shared\.loader=*$|shared\.loader=\"\${catalina.base}/shared/conf\"|" ${TOMCAT_DIR}/conf/catalina.properties

Required if any additional files need to be in the classpath

This command updates the Tomcat configuration to include ${TOMCAT_HOME}/shared/conf in the classpath.

EXPOSE 8080

Required

The value should correspond to the one which is used by Tomcat to deploy the web application. You can use port 8080 or 8443 if SSL is needed.

CMD [“catalina.sh”, “run”]

Required

A command used to run the Tomcat server.

...


Here is a sample command to build the Docker image:

...