# ── มิตซูชัยพร — Astro + Express (static) ─────────────────────────
# Build: npm run build (astro) → Runtime: node server.js (port 4321)
#
# Uses npm (like moreminimore-astroreal which deploys on EasyPanel).
# esbuild builds cleanly with npm ci (no pnpm build-script approval issues).
#
# Env: PORT (default 4321), GA_ID, FORM_EMAIL, GMAP_LAT/LNG (see .env.example)

FROM node:22-bookworm-slim

WORKDIR /app

# ── Dependencies ──────────────────────────────────────────────────
COPY package.json package-lock.json ./
RUN npm ci

# ── Source + Build ───────────────────────────────────────────────
COPY astro.config.mjs tsconfig.json ./
COPY src/ src/
COPY public/ public/
RUN npm run build

# ── Runtime ──────────────────────────────────────────────────────
COPY server.js ./
EXPOSE 4321
CMD ["node", "server.js"]
