# ── มิตซูชัยพร — Astro + Express (static) ─────────────────────────
# Build: pnpm build (astro) → Runtime: node server.js (port 4321)
#
# Mirrors moreminimore-astroreal deployment pattern that works on EasyPanel:
# serve the static Astro build from a small Node/Express server (no nginx).
#
# Env: PORT (default 4321), GA_ID, FORM_EMAIL, GMAP_LAT/LNG (see .env.example)

FROM node:22-bookworm-slim

WORKDIR /app

# ── Dependencies (pnpm 11 to match lockfile) ─────────────────────
COPY package.json pnpm-lock.yaml ./
RUN corepack enable && corepack prepare pnpm@11 --activate \
    && pnpm install --frozen-lockfile

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

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