https://imagelayers.io/?images=node:4.3.2 - I wonder how small we could get an image that's still capable of running node and having an extra user (Buildroot is root-only by default)
mhart's images are great, but I have found one issue with them. They do not contain the dependencies needed to build node-gyp based packages, more specifically and critical bcrypt package. I have fixed this issue and have pushed and maintain up-to-date node images that are built on alpine and have make, g++, etc that is needed. https://github.com/stackci/node
If you use the bcrypt node package you need g++/make to compile native extensions so there's really no way to avoid it. You can remove it after you run `npm install` in your own dockerfile, but it won't help container size at all.
I'm solving this problem by having a `dev` container with make, gcc, g++, python, and nodemon included and which is then used to install node_modules with `ENV NODE_ENV dev` set. When I'm ready to deploy, the node_modules gets deleted, installed in production mode and a production container gets built. For dev container, node_modules is a volume, and it gets copied into production container so it's self-contained.