Openfire
Openfire copied to clipboard
Improvements to Docker file
This changes the Dockerfile quite radically, so that Openfire is built within Docker rather than outside of it. This should simplify building the image, and also make the results more repeatable.
In order to maximize the use of the cache while keeping the image size under control, this uses three stages:
- The first stage locates and extracts all the POM files and any JAR files. This stage will be re-run on any change, but it short.
- The second stage takes the output of the first stage and gathers dependencies. These will be cached, unless the output of the first stage (ie, the dependency information) changes. Then it copies in the full source, and builds it.
- Finally, the runtime container is setup much as it was before, except that the runtime files are copied from the build stage rather than the filesystem directly.
The result is that a repeat build of the docker image now takes about two minutes, but can trivially be done on any docker platform (even without Java installed locally).
Notes:
- The build stage should be able to run the
mvn package
in offline mode, but maven (being maven) wants to download more during this stage. - The
.dockerignore
file has of course been changed, but someone who understands Java better than I might well improve it further.