# ============================================================================= # มิตซูชัยพร สมุทรสาคร — Astro static site # Multi-stage: 1) build with node/pnpm 2) serve dist with nginx. # # Env vars (GA_ID, FORM_EMAIL, GMAP_LAT/LNG) are injected into HTML by # entrypoint.sh at container startup (see .env.example). # Host on EasyPanel as a Dockerfile service, port 80. # ============================================================================= # ---------- Stage 1: build Astro ---------- FROM node:22-alpine AS build WORKDIR /app # pnpm RUN npm install -g pnpm@9 # Install deps (uses pnpm-lock.yaml) COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ RUN pnpm install --frozen-lockfile # Copy source + content COPY astro.config.mjs tsconfig.json ./ COPY src/ src/ COPY public/ public/ # Build -> dist/ RUN pnpm build # ---------- Stage 2: serve with nginx ---------- FROM nginx:1.27-alpine # Remove default site RUN rm -rf /usr/share/nginx/html/* # Copy built site COPY --from=build /app/dist/ /usr/share/nginx/html/ # nginx config + env-injecting entrypoint COPY nginx.conf /etc/nginx/conf.d/default.conf COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh EXPOSE 80 HEALTHCHECK --interval=30s --timeout=3s --retries=3 \ CMD wget -q -O /dev/null http://localhost/ || exit 1 ENTRYPOINT ["/entrypoint.sh"]