-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
65 lines (61 loc) · 1.73 KB
/
docker-compose.yml
File metadata and controls
65 lines (61 loc) · 1.73 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
services:
mysql:
build:
context: .
dockerfile: Dockerfile-mysql
ports:
- "13306:3306" # 修改为 13306 或其他未使用的端口
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: .
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
args:
- VOSK_MODEL_SIZE=${VOSK_MODEL_SIZE:-small}
# 添加构建缓存设置
cache_from:
- eclipse-temurin:21-jre
depends_on:
mysql:
condition: service_healthy
ports:
- "8091:8091"
networks:
- app-network
environment:
- 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
volumes:
- maven_repo:/root/.m2/repository # 持久化Maven仓库
- vosk_models:/vosk_cache # 持久化Vosk模型
restart: on-failure # 添加重启策略,如果启动失败会自动重试
networks:
app-network:
driver: bridge
volumes:
mysql_data: # 定义持久化卷
maven_repo: # 持久化Maven仓库
vosk_models: # 持久化Vosk模型