That should happen any time you change dependencies if your Dockerfile is efficiently setup, not every time you change a line in runtime code ...
Maybe that:
COPY . .
RUN npm install
Is not what you should do to have an efficient docker build phase, did you try this instead ?
COPY package.json
RUN npm install
COPY . .
Multistage builds will help if you build in two languages in the same Dockerfile.
Anyway, still slow when you add/remove a package because it redownloads everything, my best trick is to share ~/.npm cache directory, but I manage this with buildah instead of docker build.