This reduces the size of the image from 903MB down to 283MB, and builds significantly faster
Notes:
This will use the latest Node.js version (9.4 at time of writing). You might want to change the base image (e.g. to node:alpine-8) if this is undesirable.
This also switches to using /app as the default folder within the container rather than /usr/src/app as it's defined by default in the node container and doesn't need to be created prior to use.
This reduces the size of the image from 903MB down to 283MB, and builds significantly faster
Notes: This will use the latest Node.js version (9.4 at time of writing). You might want to change the base image (e.g. to node:alpine-8) if this is undesirable. This also switches to using /app as the default folder within the container rather than /usr/src/app as it's defined by default in the node container and doesn't need to be created prior to use.