69 lines
1.6 KiB
YAML
69 lines
1.6 KiB
YAML
version: '3.8'
|
|
services:
|
|
# 公共PostgresSQL
|
|
postgres:
|
|
image: postgres:18.1-alpine
|
|
container_name: trading-assistant-postgres
|
|
environment:
|
|
POSTGRES_USER: ${PG_USER:-root}
|
|
POSTGRES_PASSWORD: ${PG_PWD:-123456}
|
|
POSTGRES_DB: ${PG_DB:-monorepo}
|
|
ports:
|
|
- "${PG_PORT:-5432}:5432"
|
|
volumes:
|
|
- ./deploy/postgres/init.sql:/docker-entrypoint-initdb.d/init.sql
|
|
- pg_data:/var/lib/postgresql/data
|
|
networks:
|
|
- trading-assistant-net
|
|
restart: always
|
|
|
|
# 公共Redis
|
|
redis:
|
|
image: redis:8.4.-alpine
|
|
container_name: trading-assistant-redis
|
|
ports:
|
|
- "${REDIS_PORT:-6379}:6379"
|
|
volumes:
|
|
- ./deploy/redis/redis.conf:/etc/redis/redis.conf
|
|
- redis_data:/data
|
|
command: redis-server /etc/redis/redis.conf
|
|
networks:
|
|
- trading-assistant-net
|
|
restart: always
|
|
|
|
# 【业务服务模板】新增业务时复制以下块修改
|
|
# user:
|
|
# build:
|
|
# context: ./services/user
|
|
# dockerfile: Dockerfile
|
|
# container_name: trading-assistant-user
|
|
# environment:
|
|
# - GIN_MODE=release
|
|
# - PG_ADDR=postgres:5432
|
|
# - REDIS_ADDR=redis:6379
|
|
# ports:
|
|
# - "8080:8080"
|
|
# volumes:
|
|
# - ./logs/user:/app/logs
|
|
# networks:
|
|
# - trading-assistant-net
|
|
# restart: always
|
|
# depends_on:
|
|
# - postgres
|
|
# - redis
|
|
# deploy:
|
|
# resources:
|
|
# limits:
|
|
# cpus: "0.5"
|
|
# memory: "512M"
|
|
|
|
# 全局网络
|
|
networks:
|
|
trading-assistant-net:
|
|
driver: bridge
|
|
|
|
# 全局数据卷
|
|
volumes:
|
|
pg_data:
|
|
redis_data:
|