express-react-starter
express-react-starter copied to clipboard
Best practices suggestions
Hey, I just read the article on medium. Thanks!
Based on the best practices guide, I have a few suggestions:
- I am not sure if azure has a way to pass flags to the docker command. So it would be better to integrate the lightweight init system tini into the
Dockerfile
itself. Relevant docs section - Handling kernel signals - The base image used is
mhart/alpine-node
which does not immediately convey the exact node version being used. Additionally, why not use node official image? There's one for alpine as well. - By default, docker is run with a privileged root user. This isn't recommended as it is a security concern. The official node docker images provide a non-root user that you can use to run the actual process.
- The express recommendations for performance, among other things, recommends setting the
NODE_ENV
environment variable to'production'
. This is mentioned in the best practices guide as well.
I am by no means an expert on the subject but I collated some notes while I was trying to setup Docker for something at my workplace. Maybe you will find it useful - https://github.com/sudo-suhas/docker_notes/blob/master/11-docker-for-node-js.md#dockerfile.
These are great suggestions! I'll try and work these in soon. Feel free to submit a PR if you would like to see them in sooner. 😊