The issue clearly is in line
COPY . .
which it tries to copy the local node_modules
to the container node_modules
. you may explicitly give the names of files to copy, or to ignore a node_modules folder in any subdirectory, the syntax should be:
**/node_modules