version: '3.8' services: frontend: build: context: ./router-frontend dockerfile: dockerfile args: - SERVER_IP=${SERVER_IP:-localhost} ports: - "${FRONTEND_PORT:-5173}:5173" environment: - SERVER_IP=${SERVER_IP:-localhost} - FRONTEND_IP=${FRONTEND_IP:-localhost} - VITE_API_URL=http://${SERVER_IP:-localhost}:${BACKEND_PORT:-3000}/api/v1 - VITE_NODE_ENV=${NODE_ENV:-development} restart: always depends_on: backend: condition: service_healthy container_name: router-dashboard-frontend networks: - routernetwork healthcheck: test: ["CMD", "wget", "--spider", "-q", "http://${SERVER_IP:-localhost}:5173"] interval: 30s timeout: 10s retries: 3 start_period: 30s backend: build: context: ./router-backend dockerfile: dockerfile ports: - "${BACKEND_PORT:-3000}:3000" environment: - NODE_ENV=${NODE_ENV:-development} - DB_HOST=${DB_HOST:-mysql} - DB_PORT=${DB_PORT:-3306} - DB_USER=${DB_USER:-ve_router_user} - DB_PASSWORD=${DB_PASSWORD:-ve_router_password} - DB_NAME=${DB_NAME:-ve_router_db} - CORS_ORIGIN=http://${FRONTEND_IP:-localhost}:${FRONTEND_PORT:-5173},http://${SERVER_IP:-localhost}:${BACKEND_PORT:-3000} restart: always depends_on: mysql: condition: service_healthy healthcheck: test: ["CMD", "nc", "-z", "${SERVER_IP:-localhost}", "${BACKEND_PORT:-3000}"] interval: 30s retries: 3 start_period: 30s timeout: 10s networks: - routernetwork container_name: router-dashboard-backend mysql: image: mysql:8.0 environment: MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-rootpassword} MYSQL_DATABASE: ${DB_NAME:-ve_router_db} MYSQL_USER: ${DB_USER:-ve_router_user} MYSQL_PASSWORD: ${DB_PASSWORD:-ve_router_password} ENVIRONMENT: ${NODE_ENV:-development} volumes: - mysql_data:/var/lib/mysql - ./db-scripts:/docker-entrypoint-initdb.d:ro ports: - "${DB_PORT:-3306}:3306" command: --default-authentication-plugin=mysql_native_password restart: always healthcheck: test: ["CMD", "mysqladmin", "ping", "-h", "${DB_HOST:-mysql}", "-u${DB_USER:-ve_router_user}", "-p${DB_PASSWORD:-ve_router_password}"] interval: 10s timeout: 5s retries: 5 start_period: 30s networks: - routernetwork container_name: router-dashboard-mysql volumes: mysql_data: name: router-dashboard-mysql-data networks: routernetwork: name: routernetwork driver: bridge