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