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/conf.d/default.conf