FROM node:14-stretch AS build
WORKDIR /build/
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
COPY . .
RUN yarn build

FROM node:14-stretch AS prod
WORKDIR /app/
RUN apt-get update -y
RUN apt-get install -y ffmpeg
COPY --from=build /build/package.json /build/yarn.lock ./
COPY --from=build /build/dist ./dist
COPY assets ./assets
RUN yarn install --production --frozen-lockfile

CMD ["yarn", "start"]
