Posts

Showing posts from November, 2017

Speed up Bazel builds inside docker containers on OSX

Image
I've been using Bazel to developing on a Mac.

Occasionally I need to test docker images that are built with the amazing rules_docker. But running anything inside docker on OSX is really painfully slow. And Bazel builds need to read a ton of files, so things can take forever.

I don't think there's a definitive answer for that other than avoiding the combination of OSX+docker, but I found that helped:
Crank up Docker's own resource limits Click on the little whale sitting on your OSX status bar, and go to Preferences, Advanced and crank that up as much as you want. I've given it the maximum but I understand my browser navigation can be affected. YMMV.

Use a cache directory for Bazel builds inside docker  Deep down, what's really slow is docker going through OSX's Linux virtualization to do volume I/O. We can't currently speed up the IO, but we can reduce the amount of work that Bazel has to do every time it builds. We can cache things.

Normally, every con…