A way to use npm to orchestrate a codebase build and deployment, then hosting the resulting files with nginx. This is useful for when you use "npm start" to run a local webserver for development, but have a process to build your dynamic files into bundles for production use, such as with Webpack, Gulp, Browserify, etc. The expectation is that you have a custom script defined through npm called "start-production" which performs the build, copies the bundles to /usr/share/nginx/html where nginx will then host it at port 80.
By default, "npm run start-production" will be run from /usr/src/app the the application directory, meaning the "start-production" script must be defined in your package.json -- the script name can be overridden at runtime, for example if you wanted to run the standard 'npm start' command:
docker run -v "$PWD":/usr/src/app raydollete/npm-nginx:latest start
Per above, the source code directory can be bind mounted to the container, or you can use this image as a basis of a custom image where the code is copied:
COPY . /usr/src/app