### STAGE 1: Build ###

# We label our stage as ‘builder’
FROM node:16 as builder

WORKDIR /app

COPY . .

RUN yarn install
RUN yarn build:live

# runner container
#  - nginx, to serve static built React app

# nginx state for serving content
FROM nginx:stable-alpine
COPY --from=builder /app/dist /usr/share/nginx/html
COPY deploy/production/nginx/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
