JavaFx Maven Docker Image

Recently when setting up a Jenkins build environment to use a Docker Image with Maven that could build a JavaFX project. Thanks to some searching and a bit of hunting I was able to create a Docker image to perform just what I needed: OpenJDK, OpenJFX(JavaFX), and Maven. I wanted the DockerFile to be a part of my project so that if changes were necessary down the road I could make them in Git and my build environment would pick them up.

I began by creating a docker directory in my maven project. This gives me the ability to modify the Dockerfile as needed for my project.

Next, you need to download the official package of files for Maven. I choose to use the maven:jdk-8 as my base image. When you download this Dockerfile, do not make the mistake I did and miss the mvn-entrypoint.sh and settings-docker.xml files you will need these. Place all three files in your docker directory.

Now you need to modify the Dockerfile to include in OpenJFX on top OpenJDK in the environment. Add the lines I have highlighted below: