# Stage 1: Build
FROM node:24-alpine AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
ARG VITE_QUERY_API_URL=""
ARG VITE_SYMBOL_REGISTRY_URL=""
ARG VITE_RISK_ENGINE_URL=""
RUN npm run build

# Stage 2: Serve (unprivileged nginx, runs as uid 101, port 8080)
FROM nginxinc/nginx-unprivileged:alpine
COPY --from=build /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 8080
CMD ["nginx", "-g", "daemon off;"]
