mirror of
https://github.com/Yuyi-Oak/BlueArchiveToolkit.git
synced 2026-07-22 03:56:44 +08:00
87 lines
2.4 KiB
YAML
87 lines
2.4 KiB
YAML
# 开发环境 Docker Compose 配置
|
|
# 数据库服务为可选,通过 profile 控制
|
|
#
|
|
# 使用方式:
|
|
# 1. 使用本地数据库:docker compose -f deployments/docker-compose.dev.yml --profile local-db up -d
|
|
# 2. 使用远程数据库:不启动此文件,直接在 .env 中配置远程数据库连接信息
|
|
|
|
version: '3.9'
|
|
|
|
services:
|
|
# PostgreSQL 数据库(可选 - 仅用于本地开发)
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
container_name: bat-postgres-dev
|
|
profiles: ["local-db"] # 只有指定 --profile local-db 才启动
|
|
environment:
|
|
POSTGRES_DB: bluearchive_toolkit
|
|
POSTGRES_USER: bat_user
|
|
POSTGRES_PASSWORD: bat_dev_password
|
|
POSTGRES_INITDB_ARGS: "-E UTF8 --locale=C"
|
|
ports:
|
|
- "0.0.0.0:5432:5432"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
- ./postgres-init:/docker-entrypoint-initdb.d
|
|
- ./pg_hba.conf:/var/lib/postgresql/data/pg_hba.conf
|
|
command: postgres -c hba_file=/var/lib/postgresql/data/pg_hba.conf
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U bat_user -d bluearchive_toolkit"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- bat-dev
|
|
restart: unless-stopped
|
|
|
|
# Redis 缓存(可选 - 仅用于本地开发)
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: bat-redis-dev
|
|
profiles: ["local-db"] # 只有指定 --profile local-db 才启动
|
|
command: redis-server /usr/local/etc/redis/redis.conf
|
|
ports:
|
|
- "0.0.0.0:6379:6379"
|
|
volumes:
|
|
- redis_data:/data
|
|
- ./redis.conf:/usr/local/etc/redis/redis.conf
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "--raw", "incr", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- bat-dev
|
|
restart: unless-stopped
|
|
|
|
# pgAdmin (可选的数据库管理工具,仅用于本地数据库)
|
|
pgadmin:
|
|
image: dpage/pgadmin4:latest
|
|
container_name: bat-pgadmin-dev
|
|
profiles: ["local-db", "tools"]
|
|
environment:
|
|
PGADMIN_DEFAULT_EMAIL: admin@bat.local
|
|
PGADMIN_DEFAULT_PASSWORD: admin
|
|
PGADMIN_CONFIG_SERVER_MODE: 'False'
|
|
ports:
|
|
- "5050:80"
|
|
volumes:
|
|
- pgadmin_data:/var/lib/pgadmin
|
|
depends_on:
|
|
- postgres
|
|
networks:
|
|
- bat-dev
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
postgres_data:
|
|
driver: local
|
|
redis_data:
|
|
driver: local
|
|
pgadmin_data:
|
|
driver: local
|
|
|
|
networks:
|
|
bat-dev:
|
|
driver: bridge
|