Skip to content

Instantly share code, notes, and snippets.

@PatrickKalkman
Created January 11, 2020 21:32
Show Gist options
  • Save PatrickKalkman/d8763974f729626752732bf4d3f2622f to your computer and use it in GitHub Desktop.
Save PatrickKalkman/d8763974f729626752732bf4d3f2622f to your computer and use it in GitHub Desktop.
FROM node:12-alpine
EXPOSE 8181
HEALTHCHECK --interval=17s --timeout=3s --start-period=5s \
CMD node ./lib/healthcheck.js
# Create the work dir and set permissions as WORKDIR set the permissions as root
RUN mkdir /home/node/app/ && chown -R node:node /home/node/app
WORKDIR /home/node/app
COPY --chown=node:node package*.json ./
# set the context from now on to use the node user, which is created in the base image
USER node
RUN npm install --only=prod && npm cache clean --force --loglevel=error
# Copy app source
COPY --chown=node:node index.js .
COPY --chown=node:node lib ./lib/
CMD [ "node", "index.js"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment