Skip to content

Instantly share code, notes, and snippets.

@zaherg
Created June 12, 2017 09:01
Show Gist options
  • Save zaherg/131702be0f19a7aefb459a4dc97f99c2 to your computer and use it in GitHub Desktop.
Save zaherg/131702be0f19a7aefb459a4dc97f99c2 to your computer and use it in GitHub Desktop.
alpine with node
FROM alpine:3.5
# install node
RUN apk add --no-cache nodejs-current tini
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# Build time argument to set NODE_ENV ('production'' by default)
ARG NODE_ENV
ENV NODE_ENV ${NODE_ENV:-production}
# install npm packages: clean obsolete files
COPY package.json /usr/src/app/
RUN npm config set depth 0 && \
npm install && \
npm cache clean && \
rm -rf /tmp/*
# copy source files
COPY . /usr/src/app
EXPOSE 3000
# Set tini as entrypoint
ENTRYPOINT ["/sbin/tini", "--"]
CMD [ "npm", "start" ]
# add VCS labels for code sync and nice reports
ARG VCS_REF="local"
LABEL org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="https://github.com/alexei-led/todomvc-express.git"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment