rovellipaolo/NinjaDroid

Dockerfile structure doesn't make good use of layer caching

iantruslove opened this issue · 1 comments

Because we're copying in the entire build directory (here) any changes to any of the files in the project will bust Docker's build cache.

Splitting the ADDs up into a few more pieces and taking action based only on changes introduced by that ADD mean Docker can better optimize build times by eliminating unnecessary steps. The "cost" of additional ADDs is more layers in the image, but the layers are independent so there's no real net negative (versus layers which significantly alter underlying layers which unnecessarily increases the total image size).

Fixed with your pull request: #14