Use env vars for ports: WIZARD_PORT, MYSQL_PORT, BACKEND_PORT, FRONTEND_PORT

This commit is contained in:
Zhi
2026-03-14 08:23:49 +00:00
parent be21b2f9a2
commit 483251f96b

View File

@@ -1,4 +1,5 @@
services:
mysql:
image: mysql:8.0
container_name: harborforge-mysql
@@ -35,11 +36,11 @@ services:
- wizard_config:/config
environment:
CONFIG_DIR: /config
LISTEN_ADDR: "0.0.0.0:8080"
LISTEN_ADDR: "0.0.0.0:${WIZARD_PORT:-8080}"
MAX_BACKUPS: "5"
CORS_ORIGINS: http://127.0.0.1:3000,http://localhost:3000
CORS_ORIGINS: http://127.0.0.1:${FRONTEND_PORT:-3000},http://localhost:${FRONTEND_PORT:-3000}
ports:
- "127.0.0.1:${WIZARD_PORT:-18080}:8080"
- "127.0.0.1:${WIZARD_PORT:-8080}:${WIZARD_PORT:-8080}"
deploy:
resources:
limits:
@@ -60,7 +61,7 @@ services:
volumes:
- wizard_config:/config:ro
ports:
- "127.0.0.1:${BACKEND_PORT:-8000}:8000"
- "127.0.0.1:${BACKEND_PORT:-8000}:${BACKEND_PORT:-8000}"
depends_on:
mysql:
condition: service_healthy
@@ -70,7 +71,7 @@ services:
cpus: '0.5'
memory: 512M
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
test: ["CMD", "curl", "-f", "http://localhost:${BACKEND_PORT:-8000}/health"]
interval: 30s
timeout: 10s
retries: 3
@@ -81,20 +82,21 @@ services:
context: ./HarborForge.Frontend
dockerfile: Dockerfile
args:
VITE_WIZARD_PORT: ${WIZARD_PORT:-18080}
VITE_WIZARD_PORT: ${WIZARD_PORT:-8080}
container_name: harborforge-frontend
restart: unless-stopped
ports:
- "127.0.0.1:${FRONTEND_PORT:-3000}:3000"
- "127.0.0.1:${FRONTEND_PORT:-3000}:${FRONTEND_PORT:-3000}"
depends_on:
- wizard
- backend
deploy:
resources:
limits:
cpus: '0.25'
memory: 128M
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000"]
test: ["CMD", "wget", "-q", "--spider", "http://localhost:${FRONTEND_PORT:-3000}"]
interval: 30s
timeout: 10s
retries: 3