A repository containing docker images for Magnolia CMS.
A base image is available as a starting point for any containers running Magnolia CMS.
The image exists in different flavors: magnolia/magnolia-base:<TOMCAT VERSION>-<JRE VERSION>-<DISTRIBUTION>
.
To create a Docker image for your Magnolia project you must create your own Dockerfile which inherits the base image and copies the WAR file to the folder $CATALINA_BASE/webapps
.
The base image expects the file files/setenv.sh
be present in the build context. This file is used to configure the JRE, Tomcat and Magnolia using Java properties.
The following example configure the Java Virtual Machine:
export CATALINA_OPTS="$CATALINA_OPTS -Xms64M -Xmx2048M -server -Djava.awt.headless=true"
This image runs Magnolia Community Edition with the embedded H2 database.
The image can be configured with the following environment variables:
IS_AUTHOR (true|false)
The instance is a author instanceDEVELOP_MODE (true|false)
The instance is started in development mode
Example:
docker run -p 8080:8080 -e IS_AUTHOR=false -e DEVELOP_MODE=false magnolia/magnolia-ce:6.0-9.0.13-jre11-slim
This image runs Magnolia Community Edition with an external postgresql database.
The image can be configured with the following environment variables:
IS_AUTHOR (true|false)
The instance is a author instanceDEVELOP_MODE (true|false)
The instance is started in development modeDB_ADDRESS
Postgresql database addressDB_PORT
Postgresql database portDB_SCHEMA
Postgresql database schemaDB_USERNAME
Postgresql database usernameDB_PASSWORD
Postgresql database password
The docker compose file can be used to start a public and author instances with their respective database:
Example:
docker-compose up
The author instance is available at http://localhost:3000 and the public instance at http://localhost:3001
- Create your own bundle.
- Use a single build artefact (war) that contains a deployment configuration for all your environments.
- Alternatively, use a agnostic build artifact and configure
magnolia.home
to point outside ofCATALINA_HOME
such as for example/etc/magnolia
and configure Magnolia from theDockerfile
. - Expose java properties as environment variable in the
setenv.sh
file to configure your container. - By default,
MagnoliaServletContextListener
looks forcontextPath
orservername
which are always the same inside a container. Instead, use environment variable inside your<context-param>
of yourweb.xml
:WEB-INF/config/${env/INSTANCE_TYPE}/${env/DB_TYPE}/magnolia.properties
Scripts inside this projects make use of buildx
Please ensure to have buildx installed.
make command. Note: Change DIR env var for other image type:
make -e DIR=magnolia-base/corretto -e DOCKER_USERNAME=<yourdockerhubname> -e DOCKER_PASSWORD=<yourdockerhubname> [-e IMG_PREFIX=<yourdockerhubname>] build|push