-
Notifications
You must be signed in to change notification settings - Fork 61
/
docker-compose.yml
70 lines (61 loc) · 1.65 KB
/
docker-compose.yml
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
version: "3.8"
x-healthcheck-defaults: &healthcheck_defaults
interval: 10s # 间隔
timeout: 5s # 超时
retries: 5 # 连续失败次数
start_period: 10s # 初始化时间
services:
webstack-go-service:
container_name: webstack-go-service
build:
context: ./
dockerfile: ./Dockerfile
ports:
- "9999:9999"
volumes:
- ./configs:/opt/configs
- ./logs/:/opt/logs/
- ./assets/upload/:/opt/assets/upload
- ./lock/:/opt/lock
networks:
- webstack-go
healthcheck:
test: "/bin/netstat -anpt|grep 9999"
<<: *healthcheck_defaults
depends_on:
webstack-go-mysql:
condition: service_healthy
webstack-go-redis:
condition: service_healthy
webstack-go-mysql:
image: mysql/mysql-server:5.7
container_name: webstack-go-mysql
environment:
MYSQL_DATABASE: webstack-go
TZ: Asia/Shanghai
# 允许来自其他主机的根连接
# https://dev.mysql.com/doc/refman/5.7/en/docker-mysql-more-topics.html#docker_var_mysql-root-host
MYSQL_ROOT_HOST: "%"
MYSQL_ROOT_PASSWORD: 123456
ports:
- "3306:3306"
networks:
- webstack-go
healthcheck:
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
<<: *healthcheck_defaults
webstack-go-redis:
image: redis:6.2.4
container_name: webstack-go-redis
command: redis-server --requirepass 123456
ports:
- "6379:6379"
networks:
- webstack-go
healthcheck:
test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
<<: *healthcheck_defaults
networks:
webstack-go:
driver: bridge
name: webstack-go