services: postgres: image: pgvector/pgvector:pg16 restart: unless-stopped mem_limit: 512m cpus: "1.0" environment: POSTGRES_USER: ${POSTGRES_USER:-origin} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required} POSTGRES_DB: ${POSTGRES_DB:-origin_ai} volumes: - postgres_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-origin} -d ${POSTGRES_DB:-origin_ai}"] interval: 10s timeout: 5s retries: 5 redis: image: redis:7-alpine restart: unless-stopped mem_limit: 256m cpus: "0.5" command: redis-server --appendonly yes volumes: - redis_data:/data healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 5 api: build: context: . dockerfile: apps/api/Dockerfile restart: unless-stopped mem_limit: 1g cpus: "2.0" env_file: - .env environment: DATABASE_URL: postgresql+asyncpg://${POSTGRES_USER:-origin}:${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required}@postgres:5432/${POSTGRES_DB:-origin_ai} REDIS_URL: redis://redis:6379/0 UPLOAD_DIR: /app/uploads CORS_ORIGINS: '["http://localhost:3000","http://127.0.0.1:3000","http://localhost:8080"]' volumes: - uploads_data:/app/uploads depends_on: postgres: condition: service_healthy redis: condition: service_healthy healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8000/health"] interval: 20s timeout: 5s retries: 5 web: build: context: . dockerfile: Dockerfile.web restart: unless-stopped mem_limit: 512m cpus: "1.0" env_file: - .env environment: NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL:-/api} ORIGIN_API_URL: http://api:8000 depends_on: api: condition: service_healthy ports: - "127.0.0.1:3000:3000" healthcheck: test: ["CMD", "curl", "-f", "http://localhost:3000"] interval: 20s timeout: 5s retries: 5 nginx: image: nginx:1.27-alpine restart: unless-stopped mem_limit: 128m cpus: "0.5" depends_on: web: condition: service_healthy api: condition: service_healthy ports: - "8080:80" volumes: - ./docker/nginx/origin.conf:/etc/nginx/conf.d/default.conf:ro volumes: postgres_data: redis_data: uploads_data: