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.
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.
Join the 80/20 DevOps Newsletter
If you're an engineering leader or developer, you should subscribe to my 80/20 DevOps Newsletter. Give me 1 minute of your day, and I'll teach you essential DevOps skills. I cover topics like Kubernetes, AWS, Infrastructure as Code, and more.
Not sure yet? Check out the archive.
Unsubscribe at any time.