nex_buddy/docker-compose.full.yml

46 lines
1.3 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# 全栈部署:与 docker-compose.yml 组合使用,额外启动 PostgreSQL / Redis。
# 用法:./scripts/docker-deploy.sh --full
# 手动启动:docker compose -f docker-compose.yml -f docker-compose.full.yml up -d
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: