...
This is set of recommendations and guidelines for each ONAP project to follow as they work on creating a docker image build process.
Migrating from OPEN-O Docker Builds
The OPEN-O Integration team used to centrally run all the docker image builds using files source controlled under integration.git/test/csit/docker/. A copy of the scripts used in OPEN-O has been placed within ONAP under integration.git/packaging/docker/scripts/. However, the individual image scripts (instance-config.sh, etc.) were not carried over. The OPEN-O docker build process copied those files into the docker build directory, and auto-generated a Dockerfile definition and supporting scripts (e.g. docker-entrypoint.sh) that called those scripts as appropriate.
If you still have a copy of the OPEN-O integration repo available, the best way to migrate from the OPEN-O docker image definition is as follows:
- Run integration/test/csit/docker/scripts/gen-all-dockerfiles.sh. This will create the docker definitions for all the microservices defined in the test/csit/docker/ directory.
- Go to the subdirectory for your microservice. Inside, you'll find that a target/ directory was created by the above script. This is the auto-generated docker image definition for your microservice. You should be able to run "docker build" directly against this directory.
- Copy the contents of this directory (except for *.txt) to your ONAP repo, under a docker/ directory. The contents of *.txt are concatenated into Dockerfile, so you no longer need *.txt, and should just manually update Dockerfile going forward. Everything left in this docker directory is your docker image definition. Source control these files.
- You should be able to run "docker build" locally to build the docker image from this directory.
- TBD: Add a JJB job that will use this docker/ directory to build the docker image.
Externalize Service Dependencies (MySQL, Redis, etc.)
The OPEN-O docker images were created specifically for CSIT only, which is why it was ok to directly incorporate services like MySQL / Redis in the microservice docker images themselves. In ONAP, the docker images are intended to be run for production, so any necessary services should be run as separate docker containers outside your microservice container. So, please define your docker images so that they can have things like MySQL IP addresses passed in from the outside.