This image allows you to run your NodeJS application inside a pm2 process manager, so if for any reason, your application breaks, it will restart automatically.
The code is injected through a volume. The idea is to be able to update the code without the need to build a new image and create a new container from that image. So, this image is for development purposes only. In production you should definitely build a new image for each version of your code.
To run it:
$ docker run -d -p 80:1337 -v /path/to/code:/app richnologies/node-pm2-runtime
The contents of
/path/to/codeshould contain the source code you want to execute.
By default the entrypoint for the application is app.js, but you can override this by setting an environment variable when you launch the container:
$ docker run -d -p 80:1337 -v /path/to/code:/app -e APP=index.js richnologies/node-pm2-runtime
for example, here the entrypoint will be index.js
The image expose port 1337 so you could bind it to an external port in your server or you could use the great jwilder/nginx-proxy and set up a very simple inverse proxy base on the IP and the port by setting another environment variable:
$ docker run -d -v /path/to/code:/app -e VIRTUAL_HOST=example.com richnologies/node-pm2-runtime