If you’re using bundler for your ruby or rails project and docker you will run into docker having to install your gems everytime. You can either make a base image that has the bundle cache already on it, or you can make a small cache step in your Dockerfile.
Here I’ve setup a cache user and host to store the cache tar. It will attempt to download and untar it, run
bundle, then attempt to tar and re-upload it.
1 2 3 4 5
Doing this cut build times for my image from a few minutes to a few seconds. If you have any other tricks for speeding up builds, let me know!