Skip to content

Instantly share code, notes, and snippets.

@achmiral
Forked from sidwood/Dockerfile
Created September 26, 2017 04:39
Show Gist options
  • Save achmiral/1a0780a8b6900341fd67d7a111f57bc5 to your computer and use it in GitHub Desktop.
Save achmiral/1a0780a8b6900341fd67d7a111f57bc5 to your computer and use it in GitHub Desktop.
Node.js dockerfile templates
FROM sidwood/nodejs-app
USER root
RUN apk add --no-cache tree &&\
npm i -g nodemon
ENV NODE_ENV=development NODE_PATH=./lib:./test
EXPOSE 5858
USER node
CMD ["nodemon", "index.js"]
FROM node:7.10-alpine
RUN mkdir -p /opt/app
WORKDIR /opt/app
COPY ./package.json /opt/app
RUN apk add --update --no-cache tini &&\
apk add --virtual .build-dependencies make gcc g++ python &&\
npm install --production &&\
npm cache clean --force &&\
apk del .build-dependencies
COPY . /opt/app
ENV NODE_ENV=production NODE_PATH=./lib
EXPOSE 3000
# RUN addgroup -S app && adduser -S -g app app
# USER app
USER node
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["node", "index.js"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment