Files
DeepAudit/backend/docker-compose.yml
2025-11-09 04:23:14 +00:00

219 lines
5.2 KiB
YAML

version: '3.8'
services:
# Backend API
backend:
build:
context: .
dockerfile: Dockerfile
container_name: xcodereview-backend
ports:
- "8000:8000"
env_file:
- .env
environment:
- DATABASE_URL=postgresql+asyncpg://xcodereviewer:password@postgres:5432/xcodereviewer
- REDIS_URL=redis://redis:6379/0
- CELERY_BROKER_URL=redis://redis:6379/1
- CELERY_RESULT_BACKEND=redis://redis:6379/2
- MINIO_ENDPOINT=minio:9000
- QDRANT_URL=http://qdrant:6333
- OTLP_ENDPOINT=http://jaeger:4317
volumes:
- ./logs:/app/logs
- ./uploads:/app/uploads
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
minio:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
- xcodereview
restart: unless-stopped
# PostgreSQL Database
postgres:
image: postgres:15-alpine
container_name: xcodereview-postgres
ports:
- "5432:5432"
environment:
- POSTGRES_USER=xcodereviewer
- POSTGRES_PASSWORD=password
- POSTGRES_DB=xcodereviewer
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U xcodereviewer"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
networks:
- xcodereview
restart: unless-stopped
# Redis Cache
redis:
image: redis:7-alpine
container_name: xcodereview-redis
ports:
- "6379:6379"
command: redis-server --appendonly yes --maxmemory 512mb --maxmemory-policy allkeys-lru
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 5
start_period: 5s
networks:
- xcodereview
restart: unless-stopped
# MinIO Object Storage
minio:
image: minio/minio:latest
container_name: xcodereview-minio
ports:
- "9000:9000"
- "9001:9001"
environment:
- MINIO_ROOT_USER=minioadmin
- MINIO_ROOT_PASSWORD=minioadmin
command: server /data --console-address ":9001"
volumes:
- minio_data:/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
start_period: 10s
networks:
- xcodereview
restart: unless-stopped
# Celery Worker
celery-worker:
build:
context: .
dockerfile: Dockerfile
container_name: xcodereview-celery-worker
command: celery -A tasks.celery_app worker --loglevel=info --concurrency=4
env_file:
- .env
environment:
- DATABASE_URL=postgresql+asyncpg://xcodereviewer:password@postgres:5432/xcodereviewer
- REDIS_URL=redis://redis:6379/0
- CELERY_BROKER_URL=redis://redis:6379/1
- CELERY_RESULT_BACKEND=redis://redis:6379/2
- CELERY_WORKER=1
volumes:
- ./logs:/app/logs
- ./uploads:/app/uploads
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "celery -A tasks.celery_app inspect ping"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
networks:
- xcodereview
restart: unless-stopped
# Celery Beat (Scheduler)
celery-beat:
build:
context: .
dockerfile: Dockerfile
container_name: xcodereview-celery-beat
command: celery -A tasks.celery_app beat --loglevel=info
env_file:
- .env
environment:
- REDIS_URL=redis://redis:6379/0
- CELERY_BROKER_URL=redis://redis:6379/1
- CELERY_RESULT_BACKEND=redis://redis:6379/2
depends_on:
redis:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "test -f /tmp/celerybeat.pid"]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
networks:
- xcodereview
restart: unless-stopped
# Flower (Celery Monitoring)
flower:
build:
context: .
dockerfile: Dockerfile
container_name: xcodereview-flower
command: celery -A tasks.celery_app flower --port=5555
ports:
- "5555:5555"
environment:
- CELERY_BROKER_URL=redis://redis:6379/1
- CELERY_RESULT_BACKEND=redis://redis:6379/2
depends_on:
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5555/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
networks:
- xcodereview
restart: unless-stopped
# Qdrant Vector Database
qdrant:
image: qdrant/qdrant:latest
container_name: xcodereview-qdrant
ports:
- "6333:6333"
- "6334:6334"
volumes:
- qdrant_data:/qdrant/storage
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:6333/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
networks:
- xcodereview
restart: unless-stopped
volumes:
postgres_data:
redis_data:
minio_data:
qdrant_data:
networks:
xcodereview:
driver: bridge
name: xcodereview_backend