-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
111 lines (103 loc) · 2.85 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
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
version: "2"
# volumes的加载问题
# - /data是匿名volume,使用docker-compose rm -v可以连带容器一起删除
# volumes不要混用,例如mysql是/data/mysql 而不是/data/gogs/mysql
# 必须使用默认bridge,因为drone使用容器化的git拉取镜像,目前无法配置git容器ip,所以全部容器都要用默认bridge
# 使用dependes_on来固定容器ip
# gogs 172.17.0.2
# drone-server 172.17.0.3
# drone-agent 172.17.0.4
# postgres 172.17.0.5
# sonarqube 172.17.0.6
# 系统重启后需要docker会重新分配ip,可能与初次创建时的ip不一致,需要重新删除容器并启动
# host模式下gogs webhook会出现404错误,无法解决
services:
drone-server:
image: drone/drone
restart: unless-stopped
ports:
- "3001:8000"
depends_on:
- gogs
links:
- gogs
environment:
- DRONE_OPEN=true
- DRONE_GOGS=true
- DRONE_GOGS_URL=http://gogs:3000
- DRONE_SECRET=drone
# 必须指定host,供gogs webhook使用
- DRONE_HOST=http://172.17.0.3
volumes:
- /data/drone:/var/lib/drone/
network_mode: bridge
drone-agent:
image: drone/drone
command: agent
restart: unless-stopped
depends_on:
- drone-server
links:
- drone-server
environment:
- DRONE_SERVER=ws://drone-server:8000/ws/broker
- DRONE_SECRET=drone
volumes:
- /var/run/docker.sock:/var/run/docker.sock
network_mode: bridge
gogs:
image: gogs/gogs
restart: unless-stopped
ports:
- "3000:3000"
- "10022:22"
# 使用sqlite
# depends_on:
# - mysql
# links:
# - mysql
volumes:
- /data/gogs:/data
network_mode: bridge
# mysql:
# image: mysql:8
# restart: unless-stopped
# environment:
# - MYSQL_ROOT_PASSWORD=root
# - MYSQL_DATABASE=gogs
# - MYSQL_USER=halsn
# - MYSQL_PASSWORD=halsn
# volumes:
# - /data/mysql:/var/lib/mysql
# network_mode: bridge
postgres:
image: postgres:alpine
restart: unless-stopped
depends_on:
- drone-agent
environment:
- POSTGRES_USER=sonar
- POSTGRES_PASSWORD=sonar
volumes:
- /data/postgresql:/var/lib/postgresql
- /data/postgresql_data:/var/lib/postgresql/data
network_mode: bridge
sonarqube:
image: sonarqube:alpine
restart: unless-stopped
environment:
- SONARQUBE_HOME=/opt/sonarqube
- SONARQUBE_JDBC_USERNAME=sonar
- SONARQUBE_JDBC_PASSWORD=sonar
- SONARQUBE_JDBC_URL=jdbc:postgresql://postgres:5432/sonar
ports:
- "3002:9000"
depends_on:
- postgres
links:
- postgres
volumes:
- /data/sonarqube/data:/opt/sonarqube/data
- /data/sonarqube/extensions:/opt/sonarqube/extensions
- /data/sonarqube/lib/bundled-plugins:/opt/sonarqube/lib/bundled-plugins
network_mode: bridge