Spaces:
Sleeping
Sleeping
File size: 1,728 Bytes
ae4ceef | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | 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:
|