dev: parameterize compose so one file serves prod + dev
image/container/network/project names now come from env (WEB_IMAGE, WEB_CONTAINER, WEB_NETWORK, WEB_PROJECT) with prod values as defaults. Dev supplies its values via the gitignored .env.production. Makes dev->main merge safe (prod resolves to web/web:1.0.0/edge by default).
This commit is contained in:
+13
-5
@@ -1,4 +1,11 @@
|
||||
name: web-dev
|
||||
# Single compose file for BOTH prod and dev.
|
||||
#
|
||||
# Environment-specific values (project / image / container / network names) are
|
||||
# supplied via env vars resolved from the project-dir ".env" file
|
||||
# (in prod and dev that is a symlink -> .env.production). The defaults below are
|
||||
# the PRODUCTION values, so prod works with no extra vars; the dev worktree's
|
||||
# .env.production sets WEB_PROJECT / WEB_IMAGE / WEB_CONTAINER / WEB_NETWORK.
|
||||
name: ${WEB_PROJECT:-web}
|
||||
services:
|
||||
web:
|
||||
build:
|
||||
@@ -8,8 +15,8 @@ services:
|
||||
NEXT_PUBLIC_SUPABASE_URL: ${NEXT_PUBLIC_SUPABASE_URL}
|
||||
NEXT_PUBLIC_SUPABASE_ANON_KEY: ${NEXT_PUBLIC_SUPABASE_ANON_KEY}
|
||||
NEXT_PUBLIC_APP_URL: ${NEXT_PUBLIC_APP_URL}
|
||||
image: web-dev:1.0.0
|
||||
container_name: web-dev
|
||||
image: ${WEB_IMAGE:-web:1.0.0}
|
||||
container_name: ${WEB_CONTAINER:-web}
|
||||
restart: unless-stopped
|
||||
security_opt:
|
||||
- no-new-privileges:true
|
||||
@@ -18,7 +25,7 @@ services:
|
||||
expose:
|
||||
- "3000"
|
||||
networks:
|
||||
- dev_edge
|
||||
- default
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:3000/"]
|
||||
interval: 30s
|
||||
@@ -27,5 +34,6 @@ services:
|
||||
start_period: 10s
|
||||
|
||||
networks:
|
||||
dev_edge:
|
||||
default:
|
||||
name: ${WEB_NETWORK:-edge}
|
||||
external: true
|
||||
|
||||
Reference in New Issue
Block a user