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:
|
services:
|
||||||
web:
|
web:
|
||||||
build:
|
build:
|
||||||
@@ -8,8 +15,8 @@ services:
|
|||||||
NEXT_PUBLIC_SUPABASE_URL: ${NEXT_PUBLIC_SUPABASE_URL}
|
NEXT_PUBLIC_SUPABASE_URL: ${NEXT_PUBLIC_SUPABASE_URL}
|
||||||
NEXT_PUBLIC_SUPABASE_ANON_KEY: ${NEXT_PUBLIC_SUPABASE_ANON_KEY}
|
NEXT_PUBLIC_SUPABASE_ANON_KEY: ${NEXT_PUBLIC_SUPABASE_ANON_KEY}
|
||||||
NEXT_PUBLIC_APP_URL: ${NEXT_PUBLIC_APP_URL}
|
NEXT_PUBLIC_APP_URL: ${NEXT_PUBLIC_APP_URL}
|
||||||
image: web-dev:1.0.0
|
image: ${WEB_IMAGE:-web:1.0.0}
|
||||||
container_name: web-dev
|
container_name: ${WEB_CONTAINER:-web}
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
security_opt:
|
security_opt:
|
||||||
- no-new-privileges:true
|
- no-new-privileges:true
|
||||||
@@ -18,7 +25,7 @@ services:
|
|||||||
expose:
|
expose:
|
||||||
- "3000"
|
- "3000"
|
||||||
networks:
|
networks:
|
||||||
- dev_edge
|
- default
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:3000/"]
|
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:3000/"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
@@ -27,5 +34,6 @@ services:
|
|||||||
start_period: 10s
|
start_period: 10s
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
dev_edge:
|
default:
|
||||||
|
name: ${WEB_NETWORK:-edge}
|
||||||
external: true
|
external: true
|
||||||
|
|||||||
Reference in New Issue
Block a user