version: "3.9" services: # mongodb and redis are intentionally not exposed to the host; # they are only accessible within the Docker network. mongodb: image: mongo:7 volumes: - mongo_data:/data/db healthcheck: test: ["CMD", "mongosh", "--eval", "db.runCommand('ping')", "--quiet"] interval: 10s timeout: 5s retries: 5 start_period: 10s redis: image: redis:7-alpine volumes: - redis_data:/data healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 5 start_period: 5s backend: build: ./backend ports: - "${BACKEND_PORT:-8000}:8000" env_file: .env environment: MONGODB_URI: mongodb://mongodb:27017 REDIS_URL: redis://redis:6379/0 depends_on: mongodb: condition: service_healthy redis: condition: service_healthy volumes: - ./templates:/app/templates:ro healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8000/api/health"] interval: 15s timeout: 5s retries: 5 start_period: 30s frontend: build: ./frontend ports: - "${FRONTEND_PORT:-80}:80" depends_on: backend: condition: service_healthy volumes: mongo_data: redis_data: