feat(docker): nginx static-export image + Dokploy compose with env-driven PORT/origin

- Dockerfile: nginx:1.27-alpine serving the exported site, PORT from env,
  /healthz healthcheck, origin rewrite hook in docker-entrypoint.d
- docker/default.conf.template: envsubst PORT, clean URLs without trailing-slash
  redirect, long cache for hashed assets, no-cache for HTML/sw.js/manifest,
  301 http->https via X-Forwarded-Proto, gzip
- docker/security-headers.conf: single include so add_header survives per location
- docker-compose.yml (Dokploy, no host ports) + docker-compose.override.yml (local)
- bake canonical/OG/sitemap/robots origin to https://alterflixhub.hobbypj.com
  (was the export-time 127.0.0.1:8090), overridable via PUBLIC_ORIGIN
- docs/deploy-dokploy.md
This commit is contained in:
Bkk1234 committed 2026-11-22 22:48:12 +07:00
1 parent f6b5ba112b
commit ae34597847
44 files changed
+416 -136

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
# AlterFlixHub — static export (Dokploy)
# Dokploy เรียกไฟล์นี้ตรง ๆ: `docker compose -f ./docker-compose.yml up -d --build`
# จึง "ไม่" publish พอร์ตออก host — Traefik/Dokploy ต่อเข้า network ของ compose เอง
# รันในเครื่องดูผล → docker compose up (จะโหลด docker-compose.override.yml ที่แมปพอร์ตให้)
services:
web:
build:
context: .
dockerfile: Dockerfile
image: alterflixhub-web:latest
# ห้ามใส่ container_name: ต้องไม่ตายตัว ไม่งั้นหลาย stack บนเครื่องเดียวชนกัน
environment:
# PORT = พอร์ตที่ nginx ฟัง *ใน* คอนเทนเนอร์ (Dokploy ตั้ง PORT=30004)
PORT: ${PORT:-30004}
# origin ที่เขียนลง canonical/OG/JSON-LD/sitemap/robots ตอน start
PUBLIC_ORIGIN: ${PUBLIC_ORIGIN:-https://alterflixhub.hobbypj.com}
BAKED_ORIGIN: ${BAKED_ORIGIN:-https://alterflixhub.hobbypj.com}
TZ: ${TZ:-Asia/Bangkok}
expose:
- "${PORT:-30004}"
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:${PORT:-30004}/healthz >/dev/null 2>&1 || exit 1"]
interval: 30s
timeout: 4s
start_period: 5s
retries: 3