FROM node:16 as builder
ARG VITE_API_URL
ARG VITE_KEYCLOAK_CLIENT_ID
ARG VITE_KEYCLOAK_CLIENT_SECRET
ARG VITE_KEYCLOAK_URL
WORKDIR /usr/src/postamates_frontend
ENV NODE_OPTIONS=--max_old_space_size=4096
COPY package*.json ./
COPY yarn.lock ./
RUN yarn install
COPY . . 
RUN yarn build

FROM nginx:1.23-alpine
COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /usr/src/postamates_frontend/dist /usr/share/nginx/html
