DEV Community

Discussion on: How to speed up your daily Docker builds

 
reiz profile image
Robert Reiz

If you run your builds on a CI server, all the dependencies, in all docker stages, have to be installed on each build. Right? But if you refer to a base image that has already all the dependencies, it saves time because it only needs to be downloaded. Correct me if I'm wrong. Always willing to improve my knowledge :)

Thread Thread
 
elthrasher profile image
Matt Morgan

Ah, I guess I misunderstood the post. I thought you were talking about speeding up builds in a local dev context, not CI.

My company uses codefresh.io which provides Docker layer caching in builds, but that's not typical. With most CI (CircleCI, TravisCI, the dreaded Jenkins) you wouldn't get this out of the box. You would if you had your own permanent CI server I guess, but who the heck does that anymore? :D

I have a little experience in rolling my own Docker caching in CI. You can try using the --cache-from flag (docs.docker.com/engine/reference/c...), but it ends up being a bunch of extra scripting with probably a low ROI vs. doing as you suggest and building your own base image.