OmniFile-Processor / docker-compose.yml
Dr. Abdulmalek
deploy: OmniFile AI Processor v4.3.0
900df0b
# =============================================================================
# OmniFile AI Processor v3.0 - Docker Compose (Enhanced)
# =============================================================================
# Services: Nginx (LB) + FastAPI Backend + Redis + Celery Worker + Celery Beat + React Frontend
# Updated: 2026-05-03 (Nginx LB + Celery Beat + Resource Limits + Health Checks)
# =============================================================================
version: "3.8"
services:
# === Redis (Message Broker + Cache) ===
redis:
image: redis:7-alpine
container_name: omnifile-redis
ports:
- "6379:6379"
volumes:
- redis_data:/data
command: redis-server --appendonly yes --maxmemory 512mb --maxmemory-policy allkeys-lru
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
deploy:
resources:
limits:
cpus: "0.5"
memory: 512M
# === FastAPI Backend ===
backend:
build:
context: .
dockerfile: Dockerfile
container_name: omnifile-backend
ports:
- "5001:5001"
- "7860:7860"
environment:
- REDIS_URL=redis://redis:6379/0
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
- TRANSFORMERS_CACHE=/app/models_cache
- TORCH_HOME=/app/models_cache
- LOG_LEVEL=INFO
volumes:
- models_cache:/app/models_cache
- uploads:/app/uploads
- ./data:/app/data
- ./logs:/app/logs
depends_on:
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5001/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
restart: unless-stopped
deploy:
resources:
limits:
cpus: "2"
memory: 8G
reservations:
cpus: "1"
memory: 4G
# === Celery Worker (Async OCR Processing) ===
celery-worker:
build:
context: .
dockerfile: Dockerfile
container_name: omnifile-celery
command: celery -A tasks worker --loglevel=info --concurrency=2 --max-tasks-per-child=50 --without-heartbeat
environment:
- REDIS_URL=redis://redis:6379/0
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
- TRANSFORMERS_CACHE=/app/models_cache
- TORCH_HOME=/app/models_cache
volumes:
- models_cache:/app/models_cache
- uploads:/app/uploads
- ./data:/app/data
depends_on:
redis:
condition: service_healthy
restart: unless-stopped
deploy:
resources:
limits:
cpus: "2"
memory: 6G
reservations:
cpus: "1"
memory: 3G
# === Celery Beat (Scheduled Tasks) ===
celery-beat:
build:
context: .
dockerfile: Dockerfile
container_name: omnifile-celery-beat
command: celery -A tasks beat --loglevel=info --schedule=/app/celerybeat-schedule
environment:
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
volumes:
- celery_schedule:/app
depends_on:
redis:
condition: service_healthy
backend:
condition: service_started
restart: unless-stopped
deploy:
resources:
limits:
cpus: "0.25"
memory: 256M
# === Nginx (Reverse Proxy + Load Balancer) ===
nginx:
image: nginx:1.25-alpine
container_name: omnifile-nginx
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
- ./ssl:/etc/nginx/ssl:ro
- nginx_logs:/var/log/nginx
depends_on:
backend:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:80/health"]
interval: 15s
timeout: 5s
retries: 3
restart: unless-stopped
deploy:
resources:
limits:
cpus: "0.5"
memory: 256M
# === React Frontend (Development) ===
frontend:
build:
context: ./frontend
dockerfile: Dockerfile.dev
container_name: omnifile-frontend
ports:
- "3000:3000"
environment:
- VITE_API_URL=http://localhost:5001
volumes:
- ./frontend/src:/app/src
depends_on:
- backend
restart: unless-stopped
volumes:
redis_data:
driver: local
models_cache:
driver: local
uploads:
driver: local
celery_schedule:
driver: local
nginx_logs:
driver: local