Files
TheGame/docker/backend/Dockerfile
Hammad Jutt 5cfd7d88dd Setup multistage build to allow running backend server in dev mode so we dont have to run it outside Docker
This will automatically restart the backend server in docker anytime there are changes to the original
source files instead of copying over when running in dev mode. In production, it will still do the
normal copy/build.
2020-07-06 01:55:44 -06:00

28 lines
627 B
Docker

FROM node:12 as base
WORKDIR /usr/src/app
# Install dependencies for dev and prod
COPY package.json .
COPY lerna.json .
COPY yarn.lock .
COPY tsconfig.base.json .
COPY packages/backend/*.json ./packages/backend/
COPY packages/utils/*.json ./packages/utils/
RUN yarn install --pure-lockfile
# Dev environment doesn't run this stage or beyond
FROM base as build
# Copy source files
COPY packages/backend ./packages/backend/
COPY packages/utils ./packages/utils/
COPY packages/@types ./packages/@types/
# Build
RUN yarn --cwd ./packages/utils/ build
RUN yarn --cwd ./packages/backend/ build
CMD [ "yarn", "start:backend" ]