build(compose): split Dokploy base from local preview, drop host port from base

Base docker-compose.yml now matches Dokploy's model: expose only (no published host
port), no fixed container_name, named volume hobbypj-data, traefik.docker.network
label. Local port mapping + ./data bind moved to docker-compose.override.yml with
'volumes: !override' (otherwise compose appends two mounts on /app/data and SQLite
fails with 'disk I/O error').

Verified locally: override mode serves on PORT env (8113) from ./data; base mode
(named volume, no host port) answers inside the container on 8090 and seeds 6 rows.

README: Dokploy deploy steps (service hobbypj-contents, container port = PORT,
domain www.hobbypj.com) + note not to run the dev server and the container on the
same ./data.
This commit is contained in:
Bkk1234 committed 2026-11-23 01:08:08 +07:00
1 parent 772da6fc39
commit 94c253d4e3
5 files changed
+58 -9

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
# docker-compose.override.yml — ใช้เฉพาะตอนรันในเครื่อง (Dokploy ไม่โหลดไฟล์นี้)
#
# docker compose up -d --build → http://127.0.0.1:${PORT:-8090}
#
# ใช้ ./data บนโฮสต์แทน named volume ของ base (ดู/สำรองข้อมูลได้ตรง ๆ)
# ต้องใช้ `!override` ไม่งั้น compose จะต่อท้ายรายการ volumes แล้วมีสอง mount ซ้อนที่ /app/data
# → sqlite เปิดไม่ได้ (disk I/O error)
services:
hobbypj-contents:
volumes: !override
- ./data:/app/data
ports:
# ถ้าต้องให้เครื่องอื่นใน LAN เข้า ตั้ง BIND_ADDRESS=0.0.0.0
- "${BIND_ADDRESS:-127.0.0.1}:${PORT:-8090}:${PORT:-8090}"