The “dev” Stage
It’s fairly straightforward. All we need to do is to install npm dependencies and apply some of the best practices:
- We’ll use “node:alpine” as the based image to produce minimal image size.
- We’ll install missing shared libraries from node:alpine.
- We’ll assign a non-root user to Docker to limit its privileges
- We’ll set the environment to “development”.
- We’ll install the dependencies based on yarn lock file to achieve consistent installation across machines.