FROM node:lts AS dev
ENV NODE_ENV development
# some dir for our code
WORKDIR /app
# mount code
VOLUME ["/app"]
# this is how we start
CMD [ "yarn", "dev" ]
FROM node:lts AS prod
ENV NODE_ENV production
# install dependencies
COPY package*.json yarn*.lock ./
RUN yarn --production
# copy code
COPY . .
USER node
CMD [ "yarn", "start" ]