# Multi-stage build: compile the SPA with Node, serve the static bundle with nginx.
# The build uses the committed src/api/schema.ts + package-lock.json, so it needs no
# running server. nginx serves the SPA and reverse-proxies /api and /q to ac-code-server
# (single browser origin -> no CORS needed), mirroring the Vite dev proxy.

FROM node:20-alpine AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
RUN npm run build

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