Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Docker Registry cache backend (#1474)
We were using the inline Docker cache for the Docker images produced by `docker-publish-staging` and `docker-publish-release`. The inline Docker cache bundles the cache metadata alongside the image (increasing its size) but it does not scale well with multi-stage builds (which we use). Additionally, `inline` only supports `mode=min` – https://docs.docker.com/build/cache/backends/#cache-mode. This means that only the final layers which are exported (the last stage of the multi stage build) and therefore cached, resulting if fewer cache hits. By using a `registry` cache backend (https://docs.docker.com/build/cache/backends/registry/), we can bundle the layers to be cached into a separate image, reducing the size of the staging/production images. A `registry` backend also supports `mode=max` which allows all the intermediary layers to be cached. This should improve the amount of cache hits that we get while building the staging and production images (thus reducing the time spent building each layer). ## Changes - Change from `inline` to `registry` cache backend. - Use `mode=max` to cache all intermediary layers. - Use the external `buildcache` image as a cache reference for all the image layers (staging and production). - Extract the `env` to the workflow root (to make it easier to share the configuration between jobs).
- Loading branch information