build: Dockerfile + docker-compose with ports driven by .env

- web: nginx:alpine serving the static SPA, listens on WEB_CONTAINER_PORT
  rendered from deploy/nginx.conf.template (envsubst), gzip + cache headers,
  /healthz, proxies /api/ to the api container
- api: julia:1.13-bookworm, libpq5 + curl, Pkg.instantiate from the committed
  Manifest, listens on FARM_API_PORT, healthcheck on /api/v1/health
- db: postgres:17-alpine with 001_init.sql mounted for first-run schema,
  pg_isready healthcheck, named volume
- every port comes from .env (container port + host port separated);
  .env.example committed, .env ignored
This commit is contained in:
Bkk1234 committed 2026-11-23 01:56:39 +07:00
1 parent 05fd682e33
commit af19d04496
8 files changed
+297

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
# .env.example — คัดลอกเป็น .env ที่ราก repo แล้วแก้ค่าจริง (ห้าม commit .env)
# พอร์ตทุกตัวแก้ที่นี่ที่เดียว · container port = พอร์ตที่ process ฟังในคอนเทนเนอร์ · host port = พอร์ตที่แมปออกเครื่อง
# ---- เว็บ static (nginx) ----
WEB_CONTAINER_PORT=8080
WEB_HOST_PORT=8095
# ---- API (Julia) ----
API_CONTAINER_PORT=8000
API_HOST_PORT=8000
# ---- PostgreSQL ----
DB_HOST_PORT=5433
DB_NAME=farm_planning
DB_USER=postgres
# ต้องตั้งค่านี้เอง — compose จะไม่ยอม start ถ้าว่าง
DB_PASSWORD=
# ---- ตัวเลือก ----
# true = บันทึกผลคำนวณลง calculation_runs
FARM_PERSIST_RUNS=true
# ตอนพัฒนาให้เปิดกว้างได้ · prod ให้ใส่ origin จริง เช่น https://farm.example.com
FARM_CORS_ORIGIN=*
TZ=Asia/Bangkok