FROM node:14.21.2-alpine3.17 as build-stage
WORKDIR /app
RUN npm install -g npm@7.24.2
ARG BACKEND_URL
ENV VUE_APP_BACKEND_URL=${BACKEND_URL}
COPY . .
RUN npm ci --progress=false --no-audit
RUN VUE_APP_BACKEND_URL=${VUE_APP_BACKEND_URL} npm run build

FROM nginx:1.23.3 as production-stage
RUN mkdir /app
COPY --from=build-stage /app/dist /app
COPY --from=build-stage /app/nginx.conf /etc/nginx/nginx.conf
