Public | Automated Build

Last pushed: 3 years ago
Short Description
Short description is empty for this repo.
Full Description

Docker Node Pm2 onbuild image

This image installs Pm2 and
zlib. It is meant to be used as a base image for Node projects.

The image has the following ONBUILD and CMD and ENV instructions. This
means that it adds all files in the current directory, including the
node_modules, it uses the environment variables NODE_ENV and PORT and
exposes port 80.

ONBUILD COPY . /srv/app  # Copy current directory to /srv/app
ENV NODE_ENV production
ENV SCRIPT server.js
CMD pm2 start $SCRIPT -x -i 1 && pm2 logs # Start the script, server.js

A typical project that uses this image will have a structure similar to
the this.

$ tree .
├── server.js
├── Dockerfile
├── lib
├── node_modules
└── package.json

The inheriting Dockerfile will only contain a FROM and a MAINTAINER
field, unless it needs to tweak any environment variables.

# node-demo
FROM node-pm2:latest
MAINTAINER Anders Janmyr ""

To build a new container with the above Dockerfile and name it
node-demo, run:

$ npm install --production
$ docker build -t node-demo .
# or
$ make build

To start the newly built container;

# Start with default zookeeper
$ docker run -t node-demo
# or
$ make run

# Start with overriden environment variable
$ docker run -e "NODE_ENV=lut" -t node-demo
Docker Pull Command
Source Repository