-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
164 lines (150 loc) · 3.59 KB
/
docker-compose.yml
File metadata and controls
164 lines (150 loc) · 3.59 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# =============================================================================
# iipe PHP Docker Compose 配置
#
# 功能:
# - 构建环境编排
# - 多服务协同
# - 开发和生产环境支持
# =============================================================================
version: '3.8'
services:
# PHP构建环境
builder:
build:
context: .
dockerfile: docker/Dockerfile.builder
args:
BUILD_UID: ${BUILD_UID:-1000}
BUILD_GID: ${BUILD_GID:-1000}
image: iipe-php-builder:latest
container_name: iipe-php-builder
hostname: php-builder
privileged: true # Mock构建需要特权模式
volumes:
# 项目源码
- .:/workspace:rw
# 构建输出
- ./repo_output:/build-output:rw
# Mock配置
- ./mock_configs:/mock-configs:ro
# 缓存目录
- builder-cache:/var/cache/mock:rw
- builder-home:/home/builder:rw
# 系统目录(用于systemd支持)
- /sys/fs/cgroup:/sys/fs/cgroup:rw
working_dir: /workspace
environment:
- TZ=Asia/Shanghai
- MOCK_CONFIG_DIR=/mock-configs
- BUILD_PARALLEL_JOBS=4
- BUILD_RETRY_COUNT=2
networks:
- iipe-network
restart: unless-stopped
command: tail -f /dev/null # 保持容器运行
# 仓库服务器(用于测试)
repo-server:
image: nginx:alpine
container_name: iipe-repo-server
hostname: repo-server
ports:
- "8080:80"
- "8443:443"
volumes:
- ./repo_output:/usr/share/nginx/html/repo:ro
- ./docs/nginx.conf:/etc/nginx/nginx.conf:ro
- repo-logs:/var/log/nginx:rw
environment:
- TZ=Asia/Shanghai
networks:
- iipe-network
restart: unless-stopped
depends_on:
- builder
# 监控服务(可选)
monitor:
image: grafana/grafana:latest
container_name: iipe-monitor
hostname: monitor
ports:
- "3000:3000"
volumes:
- monitor-data:/var/lib/grafana:rw
environment:
- GF_SECURITY_ADMIN_PASSWORD=admin123
- GF_INSTALL_PLUGINS=grafana-clock-panel
- TZ=Asia/Shanghai
networks:
- iipe-network
restart: unless-stopped
profiles:
- monitoring
# 日志聚合服务(可选)
logs:
image: elasticsearch:7.17.0
container_name: iipe-logs
hostname: logs
ports:
- "9200:9200"
volumes:
- logs-data:/usr/share/elasticsearch/data:rw
environment:
- discovery.type=single-node
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- TZ=Asia/Shanghai
networks:
- iipe-network
restart: unless-stopped
profiles:
- logging
# Redis缓存(用于构建缓存)
cache:
image: redis:7-alpine
container_name: iipe-cache
hostname: cache
ports:
- "6379:6379"
volumes:
- cache-data:/data:rw
command: redis-server --appendonly yes
environment:
- TZ=Asia/Shanghai
networks:
- iipe-network
restart: unless-stopped
profiles:
- caching
# 网络配置
networks:
iipe-network:
driver: bridge
ipam:
config:
- subnet: 172.20.0.0/16
# 卷配置
volumes:
# 构建环境相关
builder-cache:
driver: local
builder-home:
driver: local
# 仓库服务相关
repo-logs:
driver: local
# 监控相关
monitor-data:
driver: local
# 日志相关
logs-data:
driver: local
# 缓存相关
cache-data:
driver: local
# 扩展配置(用于不同环境)
x-common-variables: &common-variables
TZ: Asia/Shanghai
x-common-logging: &common-logging
driver: "json-file"
options:
max-size: "10m"
max-file: "3"