The dot at the end of docker build . is your build context
When you run docker build ., the entire current directory is sent to the Docker daemon. Every file. Every byte. Your .git, your node_modules, your .venv — all of it.
A 50KB Python project can have a 1GB build context if node_modules happens to be in there. The build will feel slow because before any layer is built, the entire context has to ship to dockerd over a unix socket.
The fix is .dockerignore
Same idea as .gitignore. Anything matching is excluded from the build context.