Rebuild as Astro static site (output identical to original)

- Move all 39 cloned pages + assets into public/ (Astro copies verbatim to dist/)
  -> dist/ is byte-identical to www.mitsuthailand.com (home 143633 bytes exact)
- Add Astro project: astro.config.mjs, package.json, src/layouts/Base.astro,
  src/pages/example.astro (sample Astro component page, builds to /example/)
- Multi-stage Dockerfile: pnpm build -> nginx serve + env-injecting entrypoint
- Env-configurable: GA_ID, FORM_EMAIL, GMAP_LAT/LNG/.env.example
- Remove Python crawl tooling and old nginx-static site/ layout
- Verified: astro build -> 39 pages + example; all routes serve 200 via preview
This commit is contained in:
2026-08-06 14:41:36 +07:00
parent eea7c4780e
commit 9460be8c0e
948 changed files with 2929 additions and 1778 deletions

View File

@@ -1,31 +1,48 @@
# Static mirror of www.mitsuthailand.com (บริษัท มิตซูชัยพร จำกัด ศูนย์มิตซูบิชิ สมุทรสาคร)
# Serves the mirrored static site with nginx. All URLs are relative (domain-agnostic).
# Env vars (GA_ID, FORM_EMAIL, GMAP_LAT/LNG) are injected into HTML at startup.
# Host on EasyPanel: create a Dockerfile service, port 80.
# =============================================================================
# มิตซูชัยพร สมุทรสาคร — 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 content
# Remove default site
RUN rm -rf /usr/share/nginx/html/*
# Copy the mirrored static site
COPY site/ /usr/share/nginx/html/
# Copy built site
COPY --from=build /app/dist/ /usr/share/nginx/html/
# Custom nginx config: clean URLs via directory/index.html + caching
# nginx config + env-injecting entrypoint
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Entrypoint injects env vars (GA, form email, google map) into HTML before serving.
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
# Ship example env as defaults (real secrets should be provided via EasyPanel env,
# overriding these at runtime — see .env.example for keys).
COPY .env.example /etc/mitsu/.env.example
EXPOSE 80
HEALTHCHECK --interval=30s --timeout=3s --retries=3 \
CMD wget -q -O /dev/null http://localhost/ || exit 1
# Run the entrypoint (injects env) then nginx in foreground
ENTRYPOINT ["/entrypoint.sh"]