Hacker News new | ask | show | jobs
by skj 3395 days ago
One approach to this problem that I like is storing these dependencies in an intermediate image. Then, you can do an incremental build by referencing (rather than rebuilding) this intermediate image, and pay only the cost of downloading the raw data which should be cheap compared to the normal install process.
1 comments

Why not leverage Docker's built-in image layer caching?
I think the idea here is that the docker level caching isn't well suited for this. Eg for us we install all relevant gems with `bundle install`. If you update one gem, that the whole layer is rebuilt. Since the whole `bundle install` layer is rebuilt, every gem is fetched again from rubygems.

Yarn works the same.

Having a separate FROM image doesn't help that situation either, since you have to rebuild it.
Couldn't you FROM and then update? I'm not a ruby expert but I'd hope that it could be incremental.
That might be less effective if you can't guarantee that all the builds end up always on the same node.