FROM node:20-alpine AS build
WORKDIR /app
ARG VITE_API_URL=
ARG VITE_ADMIN_UI_PREFIX=
ARG VITE_ADMIN_ONLY=
ARG VITE_DISABLE_ADMIN=
ENV VITE_API_URL=$VITE_API_URL
ENV VITE_ADMIN_UI_PREFIX=$VITE_ADMIN_UI_PREFIX
ENV VITE_ADMIN_ONLY=$VITE_ADMIN_ONLY
ENV VITE_DISABLE_ADMIN=$VITE_DISABLE_ADMIN
COPY package.json package-lock.json* ./
RUN npm install
COPY . .
RUN npm run build

FROM nginx:1.27-alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80
