FROM node:24 AS build
WORKDIR /app
COPY ["MaksIT.WebUI/package.json", "MaksIT.WebUI/package-lock.json", "./"]
COPY ["MaksIT.WebUI/.env.prod", "./.env.prod"]
RUN npm ci
COPY ["MaksIT.WebUI/", "./"]
RUN npm run build

FROM nginx:1.27-alpine AS production
WORKDIR /app
COPY --from=build /app/dist ./dist
COPY ["MaksIT.WebUI/nginx.conf", "/etc/nginx/conf.d/default.conf"]

EXPOSE 5173
CMD ["nginx", "-g", "daemon off;"]