Files
meijiaka-zy/python-api/docker-compose.test.yml
T

103 lines
2.5 KiB
YAML

# 美家卡智影 - 测试服部署配置
# ==============================
# 用法:
# docker-compose -f docker-compose.test.yml up -d --build
#
# 包含: PostgreSQL + Redis + API + Scheduler
# 独立运行,不依赖外部网络或服务
services:
db:
image: postgres:15-alpine
container_name: meijiaka-zy-db
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: meijiaka_zy
volumes:
- /opt/meijiaka-zy/data/postgres:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
networks:
- meijiaka-zy
redis:
image: redis:7-alpine
container_name: meijiaka-zy-redis
volumes:
- /opt/meijiaka-zy/data/redis:/data
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 5
networks:
- meijiaka-zy
api:
build:
context: .
dockerfile: Dockerfile
container_name: meijiaka-zy-api
env_file: .env
environment:
- ENV=staging
- DATABASE_URL=postgresql+asyncpg://postgres:postgres@db:5432/meijiaka_zy
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_DB=0
- SECRET_KEY=${SECRET_KEY}
- VOLCENGINE_API_KEY=${VOLCENGINE_API_KEY}
- VIDU_API_KEY=${VIDU_API_KEY}
- CORS_ORIGINS=${CORS_ORIGINS:-https://dev.tapi.meijiaka.cn,http://localhost:1420,http://127.0.0.1:1420}
volumes:
- /opt/meijiaka-zy/data/logs:/root/Documents/Meijiaka-zy/logs
ports:
- "8081:8000"
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
networks:
- meijiaka-zy
restart: unless-stopped
scheduler:
build:
context: .
dockerfile: Dockerfile
container_name: meijiaka-zy-scheduler
env_file: .env
environment:
- ENV=staging
- DATABASE_URL=postgresql+asyncpg://postgres:postgres@db:5432/meijiaka_zy
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_DB=0
- SECRET_KEY=${SECRET_KEY}
- VOLCENGINE_API_KEY=${VOLCENGINE_API_KEY}
- VIDU_API_KEY=${VIDU_API_KEY}
volumes:
- /opt/meijiaka-zy/data/logs:/root/Documents/Meijiaka-zy/logs
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
command: python -m app.scheduler.main
networks:
- meijiaka-zy
restart: unless-stopped
networks:
meijiaka-zy:
driver: bridge