I\'m amazed at how good Docker\'s caching of layers works but I\'m also wondering how it determines whether it may use a cached layer or not.
Let\'s take these build
It's because your package.json file has been modified, see Removing intermediate container.
That's also usually the reason why package-manager (vendor/3rd-party) info files are COPY'ed first during docker build. After that you run the package-manager installation, and then you add the rest of your application, i.e. src.
If you've no changes to your libs, these steps are served from the build cache.