Skip to content

Instantly share code, notes, and snippets.

@waldemarnt
Last active February 10, 2021 08:52
Show Gist options
  • Save waldemarnt/50f75e06e632f54f73aa9507fd7ebca5 to your computer and use it in GitHub Desktop.
Save waldemarnt/50f75e06e632f54f73aa9507fd7ebca5 to your computer and use it in GitHub Desktop.
Dockerfile to build a Node.js app
FROM node:4.3.2
RUN useradd --user-group --create-home --shell /bin/false app &&\
npm install --global npm@3.7.5
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