# Build: generates /dist (Astro static site + Sanity Studio SPA)
FROM node:24 AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build

# Frontend: Nginx serving the static site + Sanity Studio SPA
FROM nginx:alpine AS frontend
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /app/dist /usr/share/nginx/html
EXPOSE 80
