Skip to content

feat(docker): turn branch write caching off by default

It turns out that for many docker jobs, writing the branch write cache takes many times longer than the docker build itself, so make it optional.

Thanks @jburnitz for making this observation.


Branch Write Caching

Writing cached images to the registry can be very slow: often slower than a rebuild if the main cache is relatively warm.

For that reason, writing docker builds to the branch cache is disabled by default.

It can be enabled using the docker-write-branch-cache label on your MR, or adding by the DOCKER_WRITE_BRANCH_CACHE="1" variable.

If you're finding that Docker builds on a branch are slow and could benefit from writing the cache, for maximum efficiency, turn branch write caching on temporarily, run a successful pipeline, and then turn branch write caching off again. This will allow the branch cache to be populated, while avoiding the costly cache write at the end of each docker build job.

Note that Docker builds will attempt to read the branch cache even when branch cache writing is disabled.

Edited by Andrew Newdigate

Merge request reports

Loading