Created
January 11, 2020 21:32
-
-
Save PatrickKalkman/d8763974f729626752732bf4d3f2622f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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