This article explains how to create a Docker image from a production version of LuciadFusion. It assumes that you’re already familiar with building and running images using Docker.
Generate a LuciadFusion production version
Before creating a Docker image, you must generate a production version of LuciadFusion.
For more information, see the LuciadFusion deployment article. That article explains how to configure the properties in the application-fusion.production.yml
file to match your environment.
When you’re configuring those properties, think ahead about how LuciadFusion will access the database and file system locations from within the container. An alternative is to use a placeholder value and provide environment variables for these properties when you’re running the image.
Create the Docker image
After generating the production version of LuciadFusion, navigate to the distrib/FusionPlatform
folder and unzip the LuciadFusionPlatform.zip
file.
The zip file contains the production version of LuciadFusion with an embedded Jetty container.
This is the version you’re going to use to create an image.
Create a file named Dockerfile
in the distrib/FusionPlatform
directory with this content:
# Use Java 17 JRE image as the parent image
FROM eclipse-temurin:17-jre
# create a LuciadFusionPlatform directory and make it the working directory
RUN mkdir /LuciadFusionPlatform
WORKDIR /LuciadFusionPlatform
# Copy LuciadFusion java dependencies
COPY LuciadFusionPlatform/lib lib
# Copy LuciadFusion resources
COPY LuciadFusionPlatform/resources resources
# Copy LuciadFusion statup script
COPY LuciadFusionPlatform/StartFusionPlatformServer.sh .
# Configure startup script as the entry point of the image
ENTRYPOINT ["./StartFusionPlatformServer.sh"]
To build the image, execute this command in the distrib/FusionPlatform
directory.
docker build -t luciadfusionplatform .
To run the luciadfusionplatform
image you just built, run:
docker run -p 8080:8080 testfusionplaform
Points of attention
-
In the
application-fusion.production.yml
file, you must configure thedefaultBackgroundData
,defaultRasterData
, anddefaultVectorData
properties. The LuciadFusion Studio web application uses these files in its preview function. You must add instructions to theDockerfile
to copy the default background, raster and vector data into the image, or you can use a bind mount or volume to bring these files into the container. -
It’s advisable to use volumes or bind mounts for other file system locations used by LuciadFusion, for example the
datastore
. That way, you ensure that you don’t lose that information when the container is deleted. When you add data of any kind to LuciadFusion, you must either copy it to the image, or make it available using bind mounts or volumes. -
The deployment license inside the
lib
folder is currently baked into the image. This means that you must build a new LuciadFusion image when your license expires.
An alternative is to store the license outside the container and use a bind mount to make it available within the container. In this case, you must add the location of the license to the classpath of LuciadFusion in theStartFusionPlatformServer.sh
file. -
If you’re using the GDAL connector, you must install the
liblcms2-2
andlibssl1.1
libraries in the image, because they are native dependencies of the GDAL connector that are missing in the parent image.
Next steps
This is a list of options that make use of a LuciadFusion Docker image for you to explore:
-
Create a multi-container configuration using Docker compose, consisting of a LuciadFusion container and database container. If you plan on using a PostgreSQL database, you can find an image with the PostGIS extension already installed on Dockerhub.
-
Run multiple containers of LuciadFusion as part of a multi-node setup. See the LuciadFusion multi-node setup guide for more information about configuring LuciadFusion for a multi-node setup. The article covers setting up a traditional multi-node LuciadFusion configuration, but its instructions are also applicable when you’re running multiple LuciadFusion containers. You can use a container orchestration tool to manage the different container instances.
-
Run LuciadFusion on AWS. You can change the
StartFusionPlatformServer.sh
to activate thefusion.aws
profile too. The profile allows LuciadFusion to read data stored in S3 buckets. See the LuciadFusion on AWS article for more information about running LuciadFusion on AWS. Instead of using EC2, you can use ECR to store your image and ECS to run it.