Hacker News new | ask | show | jobs
by jathu 1280 days ago
We had a very large monorepo at my previous company and building Docker images required us to set the context at the root of the directory (libraries, protos and helpers scattered around the repo). On macOS this is extremely slow as Docker copies the context into the daemon. This used to take several minutes.

Fortunately, we also used Bazel. So I created a custom Bazel rule that aggregates all the required files of a target/service then builds the Docker image within the Bazel sandbox which only contains the files we need. This massively reduced the context size and thus the image build time. From several minutes to single digit seconds.