Caching Docker builds in GitHub Actions is an excellent article by @dtinth which analyses various strategies for speeding up builds in GitHub Actions. The upshot of the article is a fairly decisive conclusion that the best two ways to improve build times are:
-
Build images via a standard
docker build
command, while using GitHub Packages' Docker registry as a cache = Longer initial build but fastest re-build times. -
Build your images via docker integrated BuildKit (
DOCKER_BUILDKIT=1 docker build
), while using a local registry and actions/cache to persist build caches = Fastest initial build but slightly longer re-build times.