Caching dependency compilation in Docker build

Another possibility could be that the environment where you are building the docker image does not support caching (e.g. on CI it is usually necessary to configure caching of artifacts, otherwise every build starts from a fresh context and won’t find any cached layer to reuse)