FROM node:14-alpine

RUN apk --no-cache add make

WORKDIR /app

COPY ./shared/package.json ./shared/package.json
WORKDIR /app/shared
RUN npm install

WORKDIR /app

COPY ./web/package.json ./web/package.json
WORKDIR /app/web
RUN npm install

WORKDIR /app

COPY ./shared ./shared
COPY ./web ./web
COPY ./Makefile ./Makefile

RUN make build_web

WORKDIR /app/web
EXPOSE 3000
CMD npm start