-
Notifications
You must be signed in to change notification settings - Fork 454
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
138 lines (132 loc) · 3.33 KB
/
docker-compose.yml
File metadata and controls
138 lines (132 loc) · 3.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
services:
mysql:
build:
context: .
dockerfile: Dockerfile-mysql
ports:
- "3306:3306" # 修改为 3306 或其他未使用的端口
networks:
- app-network
volumes:
- mysql_data:/var/lib/mysql # 持久化数据
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "xiaozhi", "-p123456"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
node:
build:
context: ./web
dockerfile: ../Dockerfile-node
depends_on:
mysql:
condition: service_healthy
ports:
- "8084:8084"
networks:
- app-network
environment:
- API_URL=http://server:8091
server:
build:
context: .
dockerfile: Dockerfile-server
target: server
args:
- VOSK_MODEL_SIZE=${VOSK_MODEL_SIZE:-small}
- TTS_MODEL=${TTS_MODEL:-vits-melo-tts-zh_en}
- DOWNLOAD_PROXY=${BUILD_PROXY:-}
# 添加构建缓存设置
cache_from:
- eclipse-temurin:21-jre
depends_on:
mysql:
condition: service_healthy
ports:
- "8091:8091"
networks:
- app-network
environment:
- SPRING_DATA_REDIS_HOST=redis
- SPRING_DATASOURCE_URL=jdbc:mysql://mysql:3306/xiaozhi?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
- SPRING_DATASOURCE_USERNAME=xiaozhi
- SPRING_DATASOURCE_PASSWORD=123456
- HOST_IP=${HOST_IP:-}
restart: always # 自动重启
deploy:
resources:
limits:
cpus: '2.0'
memory: 2G
reservations:
cpus: '0.5'
memory: 512M
dialogue:
build:
context: .
dockerfile: Dockerfile-server
target: dialogue
args:
- VOSK_MODEL_SIZE=${VOSK_MODEL_SIZE:-small}
- TTS_MODEL=${TTS_MODEL:-vits-melo-tts-zh_en}
- DOWNLOAD_PROXY=${BUILD_PROXY:-}
cache_from:
- eclipse-temurin:21-jre
depends_on:
mysql:
condition: service_healthy
ports:
- "8092:8092"
networks:
- app-network
environment:
- SPRING_DATA_REDIS_HOST=redis
- SPRING_DATASOURCE_URL=jdbc:mysql://mysql:3306/xiaozhi?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
- SPRING_DATASOURCE_USERNAME=xiaozhi
- SPRING_DATASOURCE_PASSWORD=123456
- HOST_IP=${HOST_IP:-}
restart: always
deploy:
resources:
limits:
cpus: '2.0'
memory: 2G
reservations:
cpus: '0.5'
memory: 512M
redis:
image: redis:7-alpine
container_name: redis
restart: always
command: ["redis-server", "--appendonly", "yes"]
ports:
- "6379:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
networks:
- app-network
- xiaozhi-network
deploy:
resources:
limits:
cpus: '1.0'
memory: 512M
reservations:
cpus: '0.25'
memory: 128M
networks:
app-network:
driver: bridge
xiaozhi-network:
driver: bridge
name: xiaozhi-network
volumes:
mysql_data: # 持久化数据卷
redis_data: # 持久化Redis数据