Dockerfile 900 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
FROM node:10-stretch-slim

# Set an environment variable to store where the app is installed to inside of the Docker image.
ENV WORKSPACE /app
RUN mkdir -p $WORKSPACE

# Change WORKSPACE owner
RUN  chown -R node:node $WORKSPACE

# Change running user
USER node
# This sets the context of where commands will be ran in and is documented
# on Docker's website extensively.
# Set app directory
WORKDIR $WORKSPACE

# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY --chown=node:node package.json .
COPY --chown=node:node yarn.lock .




RUN  yarn install --frozen-lockfile --silent --non-interactive
# If you are building your code for production
# RUN yarn install --production --frozen-lockfile --silent --non-interactive


# Bundle app source
COPY --chown=node:node . .


EXPOSE 3000


CMD [ "yarn", "start" ]