This tutorial demonstrates the ease of deploying OfficeFloor applications.
To deploy an OfficeFloor application, add the following build configuration to your pom.xml:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <transformers> <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <mainClass>net.officefloor.OfficeFloorMain</mainClass> </transformer> <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" /> </transformers> </configuration> </execution> </executions> </plugin>
This will create an executable jar that can be run with the following:
java -jar <project-jar-file>
In the case of this tutorial, it is:
java -jar DeployHttpServer-3.39.0.jar
As OfficeFloor applications can be run as a single command, it is easy to copy the jar file into a Docker image and run it.
A simple Docker build file might look as follows:
FROM openjdk:8 COPY target/DeployHttpServer-3.39.0.jar server.jar CMD ["java", "-Dhttp.port=8080", "-jar", "server.jar"]
Various system properties can be used to configure OfficeFloor. Please see:
The next tutorial looks at deploying to Servlet container (useful for PaaS cloud providers).