Designing for Fast Builds
Docker builds can reuse cached layers when the instruction and its inputs have not changed. Put stable dependency manifests before frequently changing source files.
For example, copy package.json and the lockfile, install dependencies, then copy application source. A source-only change can then reuse the dependency layer.