# Build multi-stage — Ligbox Ops Console SPA
# Contexto: /opt/ligbox-ops-console/frontend/

FROM node:22-alpine AS build
WORKDIR /app

ARG VITE_API_URL=https://api.ops.ligbox.com.br
ARG VITE_APP_NAME=Ligbox Ops Console
ENV VITE_API_URL=$VITE_API_URL
ENV VITE_APP_NAME=$VITE_APP_NAME

COPY package.json package-lock.json* ./
RUN npm ci --ignore-scripts 2>/dev/null || npm install

COPY . .
RUN npm run build

FROM nginx:1.27-alpine
COPY --from=build /app/dist /usr/share/nginx/html
# nginx.conf montado via volume no compose
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
