Here is a first result of my refactoring efforts and open for discussions. The branch for this Proof-of-Concept is located in branch rt/container-poc.
Introduced the directory
opennms-container with a project directory for Horizon, Minion and Sentinel. Each have their own Dockerfile.
- The Dockerfiles are now very flexible during docker build. The most important things are, you can define which is the base image, e.g. do you want to build on OpenJDK or OracleJDK and which version.
- Allow to pass PACKAGES into the build which are installed with yum install
./rpms directory convention which is available in the docker build context and all RPM files which are dropped into this directory will be installed automatically.
./build-container-image.sh are just for convenience. Integrated into our CI/CD the docker build command could be used with the appropriate build arguments.
With help from @mvrueden I added also a convenience script which allows to fetch RPM artefacts from a bamboo build as an example.
It will get the RPMS from the build artefact for Horizon, Minion and Sentinel, stores them into the RPMS directory of the project. You can then run in parallel the docker build steps for each component.
A next step would be how to integrate these in our CI/CD environment and persist a container image as a downloadable artefact.
Introduced a consolidated repository to gain control for build dependencies: https://github.com/opennms-forge/opennms-base-container with the following features:
- Build versions of dependencies in CircleCI and publish them to a repository
- Build for projects is only triggered if the directories have changed
- Control about artefact version numbers to allow rollbacks and controlled updates in the build infrastructure
Feedback is always welcome.