Spaces:
Sleeping
Sleeping
| version: '3.8' | |
| services: | |
| # 1. 核心应用 (Node.js + React) | |
| app: | |
| build: | |
| context: . | |
| dockerfile: Dockerfile | |
| container_name: codex-app | |
| ports: | |
| - "${APP_PORT:-7860}:7860" | |
| environment: | |
| - NODE_ENV=production | |
| - PORT=7860 | |
| - DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD:-postgres}@postgres:5432/codex | |
| - REDIS_URL=redis://redis:6379 | |
| - OPENAI_API_KEY=${OPENAI_API_KEY} | |
| - JWT_SECRET=${JWT_SECRET:-codex-secret-key-2024} | |
| depends_on: | |
| redis: | |
| condition: service_healthy | |
| postgres: | |
| condition: service_healthy | |
| volumes: | |
| - ./uploads:/app/uploads | |
| - ./data:/app/data | |
| restart: always | |
| networks: | |
| - codex-network | |
| # 2. 缓存与任务队列存储 (Redis) | |
| redis: | |
| image: redis:7-alpine | |
| container_name: codex-redis | |
| command: redis-server --appendonly yes | |
| ports: | |
| - "6379:6379" | |
| volumes: | |
| - redis_data:/data | |
| healthcheck: | |
| test: ["CMD", "redis-cli", "ping"] | |
| interval: 5s | |
| timeout: 3s | |
| retries: 5 | |
| restart: always | |
| networks: | |
| - codex-network | |
| # 3. 向量数据库 (PostgreSQL + PGVector) | |
| postgres: | |
| image: pgvector/pgvector:pg16 | |
| container_name: codex-postgres | |
| ports: | |
| - "5432:5432" | |
| environment: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres} | |
| POSTGRES_DB: codex | |
| volumes: | |
| - pg_data:/var/lib/postgresql/data | |
| healthcheck: | |
| test: ["CMD-SHELL", "pg_isready -U postgres"] | |
| interval: 5s | |
| timeout: 3s | |
| retries: 5 | |
| restart: always | |
| networks: | |
| - codex-network | |
| networks: | |
| codex-network: | |
| driver: bridge | |
| volumes: | |
| redis_data: | |
| pg_data: | |