48 lines
1.3 KiB
YAML
48 lines
1.3 KiB
YAML
# telesrv 第一阶段三方依赖(开发用)。
|
||
#
|
||
# 启动: docker compose up -d
|
||
# 状态: docker compose ps
|
||
# 关停: docker compose down (保留数据卷)
|
||
# 清空: docker compose down -v (连数据卷一起删,重置 schema/数据)
|
||
#
|
||
# server 端连接串见 internal/config/config.go 的默认值(localhost:5432 / localhost:6399)。
|
||
name: telesrv
|
||
|
||
services:
|
||
postgres:
|
||
image: postgres:17-alpine
|
||
container_name: telesrv-postgres
|
||
environment:
|
||
POSTGRES_DB: telesrv
|
||
POSTGRES_USER: telesrv
|
||
POSTGRES_PASSWORD: telesrv
|
||
TZ: UTC
|
||
ports:
|
||
- "5432:5432"
|
||
volumes:
|
||
- pgdata:/var/lib/postgresql/data
|
||
healthcheck:
|
||
test: ["CMD-SHELL", "pg_isready -U telesrv -d telesrv"]
|
||
interval: 5s
|
||
timeout: 3s
|
||
retries: 10
|
||
restart: unless-stopped
|
||
|
||
redis:
|
||
image: redis:7-alpine
|
||
container_name: telesrv-redis
|
||
command: ["redis-server", "--appendonly", "yes"]
|
||
ports:
|
||
- "6399:6379" # 宿主 6379 常被其他项目占用,telesrv 对外用 6399(容器内仍 6379)
|
||
volumes:
|
||
- redisdata:/data
|
||
healthcheck:
|
||
test: ["CMD", "redis-cli", "ping"]
|
||
interval: 5s
|
||
timeout: 3s
|
||
retries: 10
|
||
restart: unless-stopped
|
||
|
||
volumes:
|
||
pgdata:
|
||
redisdata:
|