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:
1 parent
05fd682e33
commit
af19d04496
8 files changed
+297
No files matched your search
+30
@@ -0,0 +1,30 @@
|
||||
# Dockerfile — เว็บ static (SPA + PWA) ของ farm-planning
|
||||
# พอร์ตที่ nginx ฟังในคอนเทนเนอร์มาจาก env WEB_CONTAINER_PORT (compose ส่งเข้ามา)
|
||||
# ไฟล์นี้คัดลอกเฉพาะ path ที่หน้าเว็บใช้จริง — ไม่ COPY ทั้ง repo
|
||||
FROM nginx:1.27-alpine
|
||||
|
||||
ENV WEB_CONTAINER_PORT=8080 \
|
||||
API_CONTAINER_PORT=8000 \
|
||||
TZ=Asia/Bangkok
|
||||
|
||||
# nginx official image แทนค่า ${VAR} ใน /etc/nginx/templates/*.template ให้เองตอน start
|
||||
COPY deploy/nginx.conf.template /etc/nginx/templates/default.conf.template
|
||||
|
||||
# ---- ไฟล์หน้าเว็บ ----
|
||||
WORKDIR /app
|
||||
COPY index.html manifest.json sw.js ./
|
||||
COPY app ./app
|
||||
COPY assets ./assets
|
||||
COPY partials ./partials
|
||||
COPY core ./core
|
||||
COPY data ./data
|
||||
COPY css ./css
|
||||
COPY logo ./logo
|
||||
COPY ["flat icon", "./flat icon"]
|
||||
COPY coding/vendor ./coding/vendor
|
||||
COPY coding/css ./coding/css
|
||||
|
||||
# EXPOSE รับ env ไม่ได้ — ใส่ค่าตั้งต้นไว้ให้ตรงกับ WEB_CONTAINER_PORT
|
||||
EXPOSE 8080
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
Reference in new issue
Block a user