FROM node:12-alpine as builder
LABEL maintainer="Vladyslav Frizen"
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
ENTRYPOINT ["./tools/wait.sh", "db:3306", "--"]
RUN npm run build
###
FROM node:12-alpine as installer
WORKDIR /usr/src/app
COPY --from=builder /usr/src/app/dist dist
COPY --from=builder /usr/src/app/package*.json ./
RUN npm install --production
###
FROM node:12-slim
WORKDIR /usr/src/app
COPY --from=installer /usr/src/app/dist dist
COPY --from=installer /usr/src/app/package*.json ./
COPY --from=installer /usr/src/app/node_modules node_modules
CMD npm run start:migration && npm run start:prod