nex_buddy/docker-compose.full.yml

46 lines
1.3 KiB
YAML
Raw Normal View History

2026-11-13 08:40:28 +00:00
# 全栈部署:与 docker-compose.yml 组合使用,额外启动 PostgreSQL / Redis。
2026-11-13 06:38:19 +00:00
# 用法:./scripts/docker-deploy.sh --full
2026-11-13 08:40:28 +00:00
# 手动启动:docker compose -f docker-compose.yml -f docker-compose.full.yml up -d
2026-11-13 06:38:19 +00:00
services:
postgres:
image: postgres:16-alpine
environment:
POSTGRES_DB: "${POSTGRES_DB:-nex_buddy}"
POSTGRES_USER: "${POSTGRES_USER:-nex_buddy}"
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD:-change-me}"
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U \"$${POSTGRES_USER}\" -d \"$${POSTGRES_DB}\""]
interval: 5s
timeout: 5s
retries: 20
restart: unless-stopped
redis:
image: redis:7-alpine
command: ["redis-server", "--appendonly", "yes"]
volumes:
- redisdata:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 20
restart: unless-stopped
api:
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
environment:
DATABASE_URL: "postgresql+asyncpg://${POSTGRES_USER:-nex_buddy}:${POSTGRES_PASSWORD:-change-me}@postgres:5432/${POSTGRES_DB:-nex_buddy}"
REDIS_URL: "redis://redis:6379/9"
volumes:
pgdata:
redisdata: