version: '3.8' services: etcd: image: bitnami/etcd:3.5 container_name: oauth-etcd restart: always volumes: - etcd_data:/bitnami/etcd environment: ALLOW_NONE_AUTHENTICATION: "yes" ETCD_ADVERTISE_CLIENT_URLS: http://etcd:2379 ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379 healthcheck: test: ["CMD", "etcdctl", "endpoint", "health"] interval: 10s timeout: 5s retries: 5 networks: - oauth-network apisix: image: apache/apisix:3.8.0-debian container_name: oauth-apisix restart: always volumes: - ./apisix/config.yaml:/usr/local/apisix/conf/config.yaml:ro - ./apisix/routes.yaml:/usr/local/apisix/conf/routes.yaml:ro depends_on: etcd: condition: service_healthy ports: - "9080:9080" # HTTP Gateway - "9443:9443" # HTTPS Gateway - "9092:9092" # Control API healthcheck: test: ["CMD", "curl", "-f", "http://localhost:9080/apisix/admin/routes"] interval: 10s timeout: 5s retries: 5 networks: - oauth-network apisix-dashboard: image: apache/apisix-dashboard:3.0.1-alpine container_name: oauth-apisix-dashboard restart: always volumes: - ./apisix/apisix-dashboard.yaml:/usr/local/apisix-dashboard/conf/conf.yaml:ro ports: - "9000:9000" depends_on: - etcd - apisix networks: - oauth-network mongodb: image: mongo:7.0 container_name: oauth-mongodb restart: always ports: - "27017:27017" environment: MONGO_INITDB_ROOT_USERNAME: admin MONGO_INITDB_ROOT_PASSWORD: admin123 MONGO_INITDB_DATABASE: oauth_db volumes: - mongodb_data:/data/db - ./oauth/backend/scripts/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro healthcheck: test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"] interval: 10s timeout: 5s retries: 5 networks: - oauth-network redis: image: redis:7-alpine container_name: oauth-redis restart: always ports: - "6379:6379" command: redis-server --appendonly yes volumes: - redis_data:/data healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 5 networks: - oauth-network backend: build: context: ./oauth/backend dockerfile: Dockerfile.dev container_name: oauth-backend restart: always ports: - "8000:8000" environment: - MONGODB_URL=mongodb://admin:admin123@mongodb:27017/oauth_db?authSource=admin - REDIS_URL=redis://redis:6379 - ENVIRONMENT=dev depends_on: mongodb: condition: service_healthy redis: condition: service_healthy volumes: - ./oauth/backend:/app - /app/__pycache__ networks: - oauth-network command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload frontend: build: context: ./oauth/frontend dockerfile: Dockerfile.dev container_name: oauth-frontend restart: always ports: - "5173:5173" environment: - NODE_ENV=development depends_on: backend: condition: service_started volumes: - ./oauth/frontend:/app - /app/node_modules networks: - oauth-network command: npm run dev -- --host 0.0.0.0 volumes: etcd_data: mongodb_data: redis_data: networks: oauth-network: driver: bridge