# Stage 1: Build the Astro project
FROM node:22-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build

# Stage 2: Serve with Nginx
FROM nginx:alpine
RUN rm -rf /usr/share/nginx/html/*
# Copy the Astro output from the builder stage
COPY --from=builder /app/dist /usr/share/nginx/html
# Expose port 80 for your Helm chart / Traefik to pick up
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]