FAQ | This is a LIVE service | Changelog

Skip to content

Allow for tox image to be built as part of CI

Monty Dawson requested to merge allow-locally-built-tox-image into master

This means that the production image, build within the build job of a pipeline, does not need to contain tox or any testing files - reducing the size of the production image.

I tried a couple of different options, including having a separate 'build' job in the pipeline which builds and pushes an image which contains tox - the downside of that is that we pollute the container registry with dev images, and additionally the tox testing task depends directly on the build job, so there was a race condition where the build_dev_image job could complete after the build job which builds the production image, but seeing as the tox testing job will start as soon as build is completed, it could start before the dev image is pushed in build_dev_image.

I decided to accept a command rather than the name of a docker file to use - as this allows for building a certain stage of a Dockerfile for multistage Dockerfiles (using --target) or using a completely separate Dockerfile.

Tested under https://gitlab.developers.cam.ac.uk/uis/devops/iam/staff-identity-api/-/pipelines/69271 - using gitlab ci: https://gitlab.developers.cam.ac.uk/uis/devops/iam/staff-identity-api/-/merge_requests/1/diffs#587d266bb27a4dc3022bbed44dfa19849df3044c

Closes #24 (closed)

Edited by Monty Dawson

Merge request reports