version: '3.8' services: # MongoDB Database mongodb: image: mongo:7.0 container_name: oauth-mongodb restart: unless-stopped ports: - "27017:27017" environment: MONGO_INITDB_ROOT_USERNAME: admin MONGO_INITDB_ROOT_PASSWORD: admin123 MONGO_INITDB_DATABASE: oauth_db volumes: - mongodb_data:/data/db - mongodb_config:/data/configdb networks: - oauth-network healthcheck: test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet interval: 10s timeout: 5s retries: 5 start_period: 40s # Redis Cache/Queue redis: image: redis:7-alpine container_name: oauth-redis restart: unless-stopped ports: - "6379:6379" command: redis-server --appendonly yes volumes: - redis_data:/data networks: - oauth-network healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 5 start_period: 30s # OAuth Backend (FastAPI) oauth-backend: build: context: ./oauth/backend dockerfile: Dockerfile target: development container_name: oauth-backend restart: unless-stopped ports: - "8000:8000" environment: - ENVIRONMENT=dev - MONGODB_URL=mongodb://admin:admin123@mongodb:27017/oauth_db?authSource=admin - REDIS_URL=redis://redis:6379 - SECRET_KEY=${SECRET_KEY:-3bf17c7f-5446-4a18-9cb3-f885eba501e8} - DATABASE_NAME=oauth_db volumes: - ./oauth/backend:/app - backend_logs:/var/log/oauth networks: - oauth-network depends_on: mongodb: condition: service_healthy redis: condition: service_healthy command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload # OAuth Frontend (React + Vite) oauth-frontend: build: context: ./oauth/frontend dockerfile: Dockerfile target: development container_name: oauth-frontend restart: unless-stopped ports: - "5173:5173" environment: - VITE_API_URL=http://localhost:8000/api/v1 - VITE_ENV=dev volumes: - ./oauth/frontend:/app - /app/node_modules networks: - oauth-network depends_on: oauth-backend: condition: service_started command: npm run dev -- --host 0.0.0.0 networks: oauth-network: driver: bridge name: oauth-network volumes: mongodb_data: driver: local name: oauth-mongodb-data mongodb_config: driver: local name: oauth-mongodb-config redis_data: driver: local name: oauth-redis-data backend_logs: driver: local name: oauth-backend-logs