version: '3.8' services: # Frontend dev server (Vite HMR) frontend: build: context: . dockerfile: Dockerfile target: builder ports: - "3000:3000" volumes: - ./src:/app/src - ./index.html:/app/index.html - /app/node_modules command: npm run dev -- --host 0.0.0.0 environment: - VITE_API_URL=http://backend:3001 depends_on: backend: condition: service_healthy db: condition: service_healthy # Backend API + WebSocket server backend: build: context: . dockerfile: Dockerfile target: builder ports: - "3001:3001" volumes: - ./server:/app/server - /app/node_modules command: npx tsx --watch server/index.ts environment: - NODE_ENV=development - CORS_ORIGIN=http://localhost:3000 - LOG_LEVEL=debug healthcheck: test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3001/api/health"] interval: 10s timeout: 5s retries: 5 start_period: 10s db: image: postgres:15-alpine restart: always environment: POSTGRES_USER: homelab POSTGRES_PASSWORD: homelab_password POSTGRES_DB: homelab_topology ports: - "5432:5432" volumes: - pgdata:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U homelab -d homelab_topology"] interval: 5s timeout: 5s retries: 5 networks: default: name: homelab-topology volumes: pgdata: