Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
76 lines (72 loc) · 1.87 KB
/
Copy pathdocker-compose.yml
File metadata and controls
76 lines (72 loc) · 1.87 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
# 启动: docker compose up -d
# 停止: docker compose down
# 清空数据卷: docker compose down -v
services:
mysql:
image: mysql:8.0
container_name: agent-mysql
restart: unless-stopped
environment:
# 与 application.yml 一致:应用使用 root / 123456
MYSQL_ROOT_PASSWORD: "${MYSQL_ROOT_PASSWORD:-123456}"
MYSQL_DATABASE: "${MYSQL_DATABASE:-agent_db}"
TZ: Asia/Shanghai
ports:
- "127.0.0.1:3306:3306"
volumes:
- mysql_data:/var/lib/mysql
- ./docker/mysql/init:/docker-entrypoint-initdb.d:ro
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
- --default-time-zone=+08:00
- --lower_case_table_names=1
- --max_connections=500
networks:
- agent-net
healthcheck:
test: ["CMD-SHELL", "MYSQL_PWD=\"$$MYSQL_ROOT_PASSWORD\" mysqladmin ping -h 127.0.0.1 -uroot"]
interval: 10s
timeout: 5s
retries: 5
start_period: 40s
deploy:
resources:
limits:
memory: 1G
redis:
image: redis:7-alpine
container_name: agent-redis
restart: unless-stopped
environment:
TZ: Asia/Shanghai
REDIS_PASSWORD: "${REDIS_PASSWORD:-123456}"
ports:
- "127.0.0.1:6379:6379"
volumes:
- redis_data:/data
command: >
redis-server
--requirepass ${REDIS_PASSWORD:-123456}
--appendonly yes
--appendfsync everysec
--maxmemory 256mb
--maxmemory-policy volatile-lru
--tcp-keepalive 300
networks:
- agent-net
healthcheck:
test: ["CMD-SHELL", "REDISCLI_AUTH=$${REDIS_PASSWORD} redis-cli ping | grep PONG"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
networks:
agent-net:
driver: bridge
name: agent-net
volumes:
mysql_data:
name: agent_mysql_data
redis_data:
name: agent_redis_data