services: # Frontend React + Vite container frontend: build: context: ./frontend dockerfile: Dockerfile ports: - "3000:80" environment: - NODE_ENV=production - VITE_API_URL=http://localhost:5000 depends_on: - backend networks: - chat-app-network restart: unless-stopped healthcheck: test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost/health"] interval: 30s timeout: 10s retries: 3 start_period: 40s # Backend Node.js + Express + Socket.IO container backend: build: context: ./backend dockerfile: Dockerfile ports: - "5000:5000" environment: - NODE_ENV=production - PORT=5000 - DATABASE_URL=postgresql://postgres:password@postgres:5432/postgres?sslmode=disable - OPENAI_API_KEY=${OPENAI_API_KEY} - QDRANT_URL=http://qdrant:6333 - QDRANT_API_KEY=${QDRANT_API_KEY} depends_on: - postgres - qdrant networks: - chat-app-network restart: unless-stopped healthcheck: test: ["CMD", "node", "-e", "require('http').get('http://localhost:5000/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) })"] interval: 30s timeout: 10s retries: 3 start_period: 40s # Qdrant Vector Database container qdrant: image: qdrant/qdrant:latest ports: - "6333:6333" - "6334:6334" volumes: - qdrant_data:/qdrant/storage environment: - QDRANT__SERVICE__HTTP_PORT=6333 - QDRANT__SERVICE__GRPC_PORT=6334 networks: - chat-app-network restart: unless-stopped healthcheck: test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:6333/health || exit 1"] interval: 30s timeout: 10s retries: 3 start_period: 30s # PostgreSQL Database container postgres: image: postgres:15-alpine ports: - "5432:5432" environment: - POSTGRES_DB=chat_app - POSTGRES_USER=postgres - POSTGRES_PASSWORD=password volumes: - postgres_data:/var/lib/postgresql/data networks: - chat-app-network restart: unless-stopped healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres -d chat_app"] interval: 30s timeout: 10s retries: 3 start_period: 30s # Named volumes for persistent data volumes: postgres_data: driver: local qdrant_data: driver: local # Custom network for service communication networks: chat-app-network: driver: bridge ipam: config: - subnet: 172.20.0.0/16