FROM node:14-alpine as builder

ARG ENVIRONMENT

COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build:${ENVIRONMENT}

FROM nginx:alpine

COPY --from=builder build /usr/share/nginx/html
COPY nginx.conf /etc/nginx/nginx.conf
ENV NGINX_ENTRYPOINT_QUIET_LOGS=true