Sam Perrin TIL Blog

Docker - Sample Dockerfile for NodeJS app

September 02, 2019

FROM node:12

# Create app directory
WORKDIR /usr/src/app

# Install app dependencies. A wildcard is used to ensure both package.json AND package-lock.json are copied
COPY package*.json ./

RUN npm install

# Bundle app source
COPY . .

HEALTHCHECK --interval=5s  \
            --timeout=5s \
            CMD curl -f || exit 1

CMD [ "node", "server.js" ]

Sam Perrin

Written by Sam Perrin who loves all things Automation related! You should follow him on Twitter