From 483251f96b6751335d878e07cefefaad19cf2436 Mon Sep 17 00:00:00 2001 From: Zhi Date: Sat, 14 Mar 2026 08:23:49 +0000 Subject: [PATCH] Use env vars for ports: WIZARD_PORT, MYSQL_PORT, BACKEND_PORT, FRONTEND_PORT --- docker-compose.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 87758b3..9436f14 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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