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

# --- Serve-Stage ---
FROM nginx:alpine
# Baked-in default build. /usr/share/nginx/html itself is normally a shared
# volume (see DEPLOYMENT_ADMIN.md) so the admin editor can publish new builds
# without redeploying this container; docker-entrypoint.d seeds it from here
# on first start so the site isn't empty before anyone publishes.
COPY --from=build /app/dist /usr/share/nginx/html-default
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY docker-entrypoint-seed.sh /docker-entrypoint.d/50-seed-content.sh
RUN chmod +x /docker-entrypoint.d/50-seed-content.sh
EXPOSE 80
