version: '3.8' services: # MySQL Database mysql: image: mysql:8.0 container_name: fmproject_mysql environment: MYSQL_USER: fmproject MYSQL_PASSWORD: fmproject_password MYSQL_DATABASE: fmproject_db MYSQL_ROOT_PASSWORD: fmproject_root_password volumes: - mysql_data:/var/lib/mysql ports: - "3306:3306" healthcheck: test: ["CMD-SHELL", "mysqladmin ping -h localhost -u fmproject -pfmproject_password"] interval: 10s timeout: 5s retries: 5 # Redis Cache redis: image: redis:7-alpine container_name: fmproject_redis ports: - "6379:6379" volumes: - redis_data:/data healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 5 # MinIO S3-compatible Storage minio: image: minio/minio:latest container_name: fmproject_minio environment: MINIO_ROOT_USER: minioadmin MINIO_ROOT_PASSWORD: minioadmin ports: - "9000:9000" - "9001:9001" volumes: - minio_data:/data command: server /data --console-address ":9001" healthcheck: test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] interval: 30s timeout: 20s retries: 3 # FastAPI Backend backend: build: context: . dockerfile: Dockerfile container_name: fmproject_backend environment: DATABASE_URL: mysql+pymysql://fmproject:fmproject_password@mysql:3306/fmproject_db REDIS_URL: redis://redis:6379 CELERY_BROKER_URL: redis://redis:6379 CELERY_RESULT_BACKEND: redis://redis:6379 SECRET_KEY: your-super-secret-key-change-in-production DEBUG: "False" S3_ENDPOINT: http://minio:9000 S3_ACCESS_KEY: minioadmin S3_SECRET_KEY: minioadmin INSIGHTFACE_GPU: "False" INSIGHTFACE_GPU_AUTO: "True" QDRANT_URL: "" QDRANT_API_KEY: "" QDRANT_COLLECTION: face_embeddings QDRANT_ENABLE: "True" STRIPE_ENABLED: "False" STRIPE_SECRET_KEY: "" STRIPE_WEBHOOK_SECRET: "" ports: - "8000:8000" depends_on: mysql: condition: service_healthy redis: condition: service_healthy minio: condition: service_healthy volumes: - .:/app command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8000/health"] interval: 30s timeout: 10s retries: 3 # Nginx Reverse Proxy nginx: image: nginx:alpine container_name: fmproject_nginx ports: - "80:80" - "443:443" volumes: - ./nginx.conf:/etc/nginx/nginx.conf:ro depends_on: - backend healthcheck: test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost/health"] interval: 30s timeout: 10s retries: 3 volumes: mysql_data: redis_data: minio_data: networks: default: name: fmproject_network