Docker strategies¶
These are the strategies we use for managing docker images in the digitalmarketplace
DockerHub repo
Automatically managed¶
Most of our docker images are automatically managed by Jenkins jobs that run when a particular repo has changes merged to master.
As part of the release-pipeline job these include:
api
search-api
antivirus-api
user-frontend
briefs-frontend
brief-responses-frontend
buyer-frontend
supplier-frontend
admin-frontend
router
As part of the build-scripts job:
scripts
The above jobs use a build-image job when code is merged to master in their respective git repositories.
The build-image job:
Checks out the master branch of the repository
Builds the docker image from the Dockerfile in the repo
Tags the docker image with the git short hash
Pushes the tag
Tags and pushes the build as
latest
The build-scripts job is a good example of how to add a docker image for a repo that will then be automatically managed.
Add the
Dockerfile
to the base of thedigitalmarketplace-<repo-name>
repoCreate a repo for the docker image on dockerhub like
digitalmarketplace/<repo-name>
(find the credentials indigitalmarketplace-credentials/pass/docker.com/org-owner
)Add a jenkins job that polls github for changes to
digitalmarketplace/<repo-name>:master
which runs the build-image job
Makefile managed¶
We have three base images in the digitalmarketplace-docker-base repository:
These are updated using make
commands found in the repo’s Makefile.
You can find out more about how to update them in the repo’s README.
Manually managed¶
Note
it is worth reviewing whether you can incorporate a new docker image in to any of the other strategies before using a
Dockerfile managed docker image. It is likely that your code should be a new repo if it requires its own Dockerfile
.
In that case it is possible to use the automatically managed strategy.
There are a couple of Docker images we create and use that do not fit into any of the categories above. These processes are considered technical debt however; it is an ongoing issue to look at better tools for this kind of thing.
For database backups, we use a digitalmarketplace/db-backup docker image. This is kept in the digitalmarketplace-aws repo Dockerfile, and updated by a single Makefile task, deploy-db-backup-app.
You can find out more about the backups in the Database backups section of the manual.