Skip to content

Instantly share code, notes, and snippets.

@raisiqueira
Last active September 2, 2016 12:27
Show Gist options
  • Save raisiqueira/95ef16146fe65f17b6d01a49a37c9196 to your computer and use it in GitHub Desktop.
Save raisiqueira/95ef16146fe65f17b6d01a49a37c9196 to your computer and use it in GitHub Desktop.
Dockerfile for Node APPS
version: '2'
services:
library:
build: .
environment:
NODE_ENV: production
ports:
- '3000:3000'
version: '2'
services:
library:
build:
context: .
dockerfile: Dockerfile
command: node_modules/.bin/nodemon --exec npm start
environment:
NODE_ENV: development
ports:
- 3000:3000
volumes:
- .:/home/app/library
- /home/app/library/node_modules
FROM node:4.3.2
RUN useradd --user-group --create-home --shell /bin/false app &&\
npm install --global [email protected]
ENV HOME=/home/app
COPY package.json npm-shrinkwrap.json $HOME/library/
RUN chown -R app:app $HOME/*
USER app
WORKDIR $HOME/library
RUN npm cache clean && npm install --silent --progress=false
USER root
COPY . $HOME/library
RUN chown -R app:app $HOME/*
USER app
CMD ["npm", "start"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment