Speed Up Docker Builds With Cache Mounts

You can speed up your docker builds by adding cache mounts to your Dockerfile.

Cache mounts let you specify a persistent package cache to be used during builds. The persistent cache helps speed up build steps, especially steps that involve installing packages using a package manager. Having a persistent cache for packages means that even if you rebuild a layer, you only download new or changed packages.

Click here to read the docs.

I was also testing if I can use bind mounts to restore cached dependencies from GitHub actions into a docker build. That seems to be hacky and unreliable.


Master GitHub Actions with a Senior Infrastructure Engineer

As a senior staff infrastructure engineer, I share exclusive, behind-the-scenes insights that you won't find anywhere else. Get the strategies and techniques I've used to save companies $500k in CI costs and transform teams with GitOps best practices—delivered straight to your inbox.

Not sure yet? Check out the archive.

Unsubscribe at any time.