services: database: image: mongo:7 restart: always env_file: .env volumes: - mongo_data:/data/db - ./init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro healthcheck: test: [ "CMD", "mongosh", "--quiet", "--eval", "db.adminCommand('ping').ok" ] interval: 10s timeout: 5s retries: 5 networks: - pharmagent-network redis: image: redis:7-alpine restart: always env_file: .env command: /bin/sh -c 'exec redis-server --requirepass "$${SPRING_DATA_REDIS_PASSWORD:?SPRING_DATA_REDIS_PASSWORD is required}" --appendonly yes --appendfsync everysec' healthcheck: test: [ "CMD-SHELL", "redis-cli -a \"$${SPRING_DATA_REDIS_PASSWORD:?SPRING_DATA_REDIS_PASSWORD is required}\" ping | grep PONG" ] interval: 10s timeout: 5s retries: 5 volumes: - redis_data:/data networks: - pharmagent-network rabbitmq: image: rabbitmq:3.11-management restart: always env_file: .env environment: RABBITMQ_PLUGINS: "rabbitmq_stomp rabbitmq_management rabbitmq_web_dispatch" healthcheck: test: rabbitmq-diagnostics -q ping interval: 10s timeout: 5s retries: 5 volumes: - rabbitmq_data:/var/lib/rabbitmq networks: - pharmagent-network agent: build: ./agent image: ${DOCKER_REGISTRY:-ghcr.io/nguyentukien}/pharmagent-agent:${TAG:-latest} restart: always env_file: .env healthcheck: test: [ "CMD-SHELL", "curl -f http://localhost:8000/health || exit 1" ] interval: 20s timeout: 5s retries: 5 networks: - pharmagent-network backend: build: ./backend image: ${DOCKER_REGISTRY:-ghcr.io/nguyentukien}/pharmagent-backend:${TAG:-latest} restart: always env_file: .env environment: SPRING_DATA_REDIS_URL: redis://:${SPRING_DATA_REDIS_PASSWORD:?SPRING_DATA_REDIS_PASSWORD is required}@redis:6379 depends_on: database: condition: service_healthy redis: condition: service_healthy rabbitmq: condition: service_healthy healthcheck: test: [ "CMD-SHELL", "wget -qO- http://localhost:8080/actuator/health | grep UP || exit 1" ] interval: 30s timeout: 10s retries: 5 volumes: - backend_logs:/app/logs ports: - "8080:8080" networks: - pharmagent-network gateway: build: ./gateway image: ${DOCKER_REGISTRY:-ghcr.io/nguyentukien}/pharmagent-gateway:${TAG:-latest} restart: always env_file: .env environment: REDIS_URL: redis://:${SPRING_DATA_REDIS_PASSWORD:?SPRING_DATA_REDIS_PASSWORD is required}@redis:6379 ports: [ "9000:9000" ] depends_on: backend: condition: service_healthy agent: condition: service_healthy redis: condition: service_healthy healthcheck: test: [ "CMD-SHELL", "curl -f http://localhost:9000/health || exit 1" ] interval: 15s timeout: 5s retries: 5 networks: - pharmagent-network frontend: image: node:24-alpine working_dir: /app command: sh -c "npm install && npm run dev -- --host 0.0.0.0" restart: always environment: VITE_GATEWAY_PROXY_TARGET: http://gateway:9000 VITE_WS_PROXY_TARGET: http://backend:8080 CHOKIDAR_USEPOLLING: "true" CHOKIDAR_INTERVAL: "100" ports: - "5173:5173" depends_on: gateway: condition: service_healthy volumes: - ./frontend:/app - frontend_node_modules:/app/node_modules healthcheck: test: [ "CMD-SHELL", "wget -qO- http://localhost:5173/ || exit 1" ] interval: 15s timeout: 5s retries: 5 networks: - pharmagent-network volumes: mongo_data: redis_data: rabbitmq_data: backend_logs: frontend_node_modules: networks: pharmagent-network: driver: bridge