Hacker News new | ask | show | jobs
by emailgregn 3908 days ago
Install each of the pip/bundler requirements with a separate dockerfile RUN command. Each gets cached into its own container filesystem layer that way and only new requirements are pulled. Use your favourite templating tool to generate the dockerfile with multiple run commands.

I wrote djtempl ( https://github.com/emailgregn/djtempl ) for my purposes.

1 comments

But let's say a dependency is changed. Won't modifying that RUN directive invalidate the cache for everything after it, potentially rebuilding a ton of stuff anyway?
Yup, that's the trade-off.
It's unfortunate that Docker uses an imperative model. A functional model would have much better cache utilization.