-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
executable file
·444 lines (428 loc) · 16.4 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
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
version: "3.9"
#创建网桥
networks:
net1:
name: my_net
driver: bridge #指定网络模式
ipam:
driver: default
config:
- subnet: 172.1.1.0/24 #指定ip段(防火墙需设置白名单避免将此认作外网ip进行拦截,导致容器无法访问宿主机: "ufw allow from 172.1.0.0/16")
#创建卷
volumes:
logs_volume:
name: logs_volume_name #在宿主机的目录名
# 定义日志模板
x-logging: &default-logging
driver: json-file
options:
max-size: "200k"
max-file: "10"
services:
nginx:
image: nginx:${nginx:-latest}
container_name: nginx
hostname: docker-nginx
depends_on:
- php
- mysql
restart: always
# user: www-data
working_dir: /var/www/ #进入容器的默认目录
# env_file: ./.env
environment:
TZ: ${TZ:-Asia/Shanghai}
ports: #docker是有独立的firewall规则的,即时宿主机对外关闭某个端口,实际上docker的相同端口并不会被作用,除非docker本身规则禁止对外,如 127.0.0.1:80:80
- 80:80
- 443:443
- 2053:443
- 2083:443
- 2087:443
- 2096:443
- 8443:443
- 1818:1818
- 1819:1819
volumes:
- ${PWD}/../../www:/var/www/:rw
- ${PWD}/conf/nginx/nginx.conf:/etc/nginx/nginx.conf:ro #nginx根配置
- ${PWD}/conf/nginx/conf.d/:/etc/nginx/conf.d/:ro #nginx配置
- ${PWD}/conf/nginx/404.html:/usr/share/nginx/html/404.html:ro
- ${PWD}/data/logs/nginx/:/var/logs/:rw #日志
logging: *default-logging
deploy:
resources:
limits:
memory: 256M
reservations:
memory: 8M
networks:
net1:
ipv4_address: 172.1.1.99
aliases:
- docker-nginx
- twbhub.top
mysql:
image: mysql:${mysql:-8.0-debian}
container_name: mysql
hostname: docker-mysql
restart: always
user: root #容器内的目录需给root权限/var/lib/mysql /var/run/mysqld
environment: #设置环境变量
TZ: ${TZ:-Asia/Shanghai}
ports:
- 127.0.0.1:3306:3306
volumes:
- ${PWD}/../proxy/dao/users.sql:/docker-entrypoint-initdb.d/users.sql:ro #把sql放在docker-entrypoint-initdb.d下,mysql会自动执行
- /usr/local/mysql8-docker/data/:/var/lib/mysql:rw #库数据,一旦使用,设置的环境变量和自动执行sql功能则失效
- ${PWD}/conf/mysql/my.cnf:/etc/mysql/conf.d/my.cnf:ro #配置文件
- ${PWD}/data/logs/mysql/:/var/logs/:rw #日志
logging: *default-logging
deploy:
resources:
limits:
cpus: 1.5
memory: 1024M
reservations:
memory: 64M
networks:
net1:
ipv4_address: 172.1.1.98
aliases:
- docker-mysql
php:
# build:
# context: ${PWD}/conf/php
# dockerfile: Dockerfile
image: ghcr.io/twbworld/php:${php:-latest}
container_name: php
hostname: docker-php
depends_on:
- mysql
command:
- /bin/bash
- -c
- |
chmod +x /etc/cron.monthly/*
service cron start
docker-php-entrypoint php-fpm
restart: always
working_dir: /var/www/ #进入容器的默认目录
environment:
TZ: ${TZ:-Asia/Shanghai}
volumes:
- ${PWD}/../../www/:/var/www/:rw
- /root/.ssh/id_rsa:/root/.ssh/id_rsa:ro #ssh私钥,用于github验证
- /root/.ssh/known_hosts:/root/.ssh/known_hosts:ro #记录github服务器的白名单
- ${PWD}/data/logs/php/:/var/logs/:rw #日志
logging: *default-logging
deploy:
resources:
limits:
cpus: 1.5
memory: 512M
reservations:
memory: 16M
networks:
net1:
ipv4_address: 172.1.1.97
aliases:
- docker-php
node:
image: node:${node:-21-alpine}
container_name: node
hostname: docker-node
# tty: true
depends_on:
- php
command:
- /bin/sh
- -c
- |
sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
apk add xdg-utils
echo "nginx ck.cc.cc" >> /etc/hosts
npm run dev -- --host 0.0.0.0
restart: always
working_dir: /var/www/ck/web/
environment:
TZ: ${TZ:-Asia/Shanghai}
volumes:
- ${PWD}/../ck/:/var/www/ck/:rw
logging: *default-logging
networks:
net1:
ipv4_address: 172.1.1.84
aliases:
- docker-node
# redis:
# image: redis:${redis:-latest}
# container_name: redis
# hostname: docker-redis
# restart: always
# environment:
# TZ: ${TZ:-Asia/Shanghai}
# logging: *default-logging
# networks:
# net1:
# ipv4_address: 172.1.1.94
# aliases:
# - redis
# - docker-redis
# - redis6
# trojan:
# image: p4gefau1t/trojan-go:${trojan:-latest}
# container_name: trojan
# hostname: docker-trojan
# tty: true
# privileged: true
# command: /bin/bash -c "/sbin/init"
# depends_on:
# - mysql
# restart: always
# environment: #设置环境变量
# TZ: ${TZ:-Asia/Shanghai}
# volumes:
# - ${PWD}/data/cert/cc.cc/:/root/cert/:ro
# - ${PWD}/proxy/config/.trojan-go.json:/etc/trojan-go/config.json:rw
# logging: *default-logging
# deploy:
# resources:
# limits:
# memory: 512M
# reservations:
# memory: 16M
# networks:
# net1:
# ipv4_address: 172.1.1.96
# aliases:
# - trojan
# - docker-trojan
# - trojan-go
# proxy:
# # image: ghcr.io/twbworld/proxy:0.1.0
# build:
# context: ${PWD}/../proxy
# dockerfile: Dockerfile
# container_name: proxy
# # depends_on:
# # - mysql
# restart: always
# working_dir: /app/ #进入容器的默认目录
# ports:
# - 8080:8080
# volumes:
# - ${PWD}/../proxy/config/.env:/app/config/.env:ro
# - ${PWD}/../proxy/config/.trojan-go:/app/config/.trojan-go:ro
# logging: *default-logging
# networks:
# net1:
# ipv4_address: 172.1.1.86
# es:
# image: elasticsearch:${es:-latest}
# container_name: es
# hostname: docker-es
# restart: always
# environment:
# TZ: ${TZ:-Asia/Shanghai}
# ES_JAVA_OPTS:
# discovery.type:
# ports:
# - 9200:9200
# - 9300:9300
# volumes:
# - /var/www/es/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro
# - /var/www/es/data/:/usr/share/elasticsearch/data/:rw
# - /var/www/es/plugins/:/usr/share/elasticsearch/plugins/:rw
# logging: *default-logging
# networks:
# net1:
# ipv4_address: 172.1.1.92
# aliases:
# - es
# - docker-es
# - es7
# kibana:
# image: kibana:${kibana:-latest}
# container_name: kibana
# hostname: docker-kibana
# depends_on:
# - es
# restart: always
# ports:
# - 5601:5601
# volumes:
# - /var/www/es/kibana.yml:/usr/share/kibana/config/kibana.yml:ro
# environment:
# TZ: ${TZ:-Asia/Shanghai}
# ELASTICSEARCH_HOSTS:
# logging: *default-logging
# networks:
# net1:
# ipv4_address: 172.1.1.91
# aliases:
# - kibana
# - docker-kibana
# logstash:
# image: docker.elastic.co/logstash/logstash:${logstash:-latest}
# container_name: logstash
# hostname: docker-logstash
# depends_on:
# - kibana
# restart: always
# environment:
# TZ: ${TZ:-Asia/Shanghai}
# ports:
# - 5044:5044
# volumes:
# - /var/www/es/logstash/logstash.conf:/usr/share/logstash/pipeline/logstash.conf:ro
# - /var/www/es/logstash/logstash.yml:/usr/share/logstash/config/logstash.yml:ro
# - /var/www/es/logstash/mysql-connector-java-8.0.23/mysql-connector-java-8.0.23.jar:/usr/share/logstash/pipeline/mysql-connector-java-8.0.23.jar:rw
# logging: *default-logging
# networks:
# net1:
# ipv4_address: 172.1.1.90
# aliases:
# - logstash
# - docker-logstash
# rancher:
# image: rancher/server:${rancher:-stable}
# container_name: rancher
# hostname: docker-rancher
# depends_on:
# - mysql57
# command: /bin/bash -c "/usr/bin/s6-svscan /service --db-host 172.1.1.1 --db-user root --db-pass root --db-name cattle"
# ports:
# - 8081:8080
# restart: unless-stopped
# environment:
# TZ: ${TZ:-Asia/Shanghai}
# logging: *default-logging
# networks:
# net1:
# ipv4_address: 172.1.1.87
# aliases:
# - rancher
# - docker-rancher
# qinglong:
# image: whyour/qinglong
# container_name: qinglong
# hostname: docker-qinglong
# entrypoint:
# - /bin/bash
# - -c
# - | #环境变量失效请执行: source /ql/data/config/env.sh
# echo "{\"username\":\"${QL_USERNAME:-root}\",\"password\":\"${QL_PASSWORD:-root}\",\"token\":\"${QL_TOKEN}\",\"retries\":0,\"twoFactorActivated\":false,\"twoFactorActived\":false}" > /ql/sample/auth.sample.json
# sed -i "s/js py/js py sh/" /ql/sample/config.sample.sh
# sed -i "s/crond/#crond/" /ql/docker/docker-entrypoint.sh
# ./docker/docker-entrypoint.sh
# sleep 3s
# nginx -s stop
# echo "export TG_BOT_TOKEN=\"${JD_TG_BOT_TOKEN}\"" >> /ql/data/config/env.sh
# echo "export TG_USER_ID=\"${TG_CHAT_ID}\"" >> /ql/data/config/env.sh
# echo "export JD_COOKIE=\"${JD_COOKIE}\"" >> /ql/data/config/env.sh
# source /ql/data/config/env.sh
# bash <(curl -s -S -L https://ghproxy.com/https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/main/qinglong/ray-dotnet-install.sh)
# ql repo https://github.com/RayWangQvQ/BiliBiliToolPro.git "bili_task_"
# ql repo https://github.com/zero205/JD_tencent_scf.git "jd_|jx_|getJDCookie" "backUp|icon" "^jd[^_]|USER|sendNotify|sign_graphics_validate|JDJR|JDSign" "main"
# crond -f >/dev/null
# # ql repo https://github.com/twbworld/NeteaseCloudMusicTasks.git "index.py" "" "py" "main"
# # cp /ql/repo/twbworld_NeteaseCloudMusicTasks_main/config.json /ql/scripts/twbworld_NeteaseCloudMusicTasks_main/
# # apk --no-cache add -f bash pip g++
# # pip install -r /ql/repo/twbworld_NeteaseCloudMusicTasks_main/requirements.txt --no-cache-dir
# restart: always
# environment:
# TZ: ${TZ:-Asia/Shanghai}
# TG_USER_ID: ${TG_CHAT_ID} #已交由entrypoint处理
# USERNAME_163: ${USERNAME_163}
# PASSWORD_163: ${PASSWORD_163}
# Ray_BiliBiliCookies__1: ${BLBL_COOKIES}
# Ray_Security__UserAgent: ${UA}
# Ray_DailyTaskConfig__NumberOfCoins: ${BLBL_Ray_DailyTaskConfig__NumberOfCoins:-5} #投币数量
# Ray_DailyTaskConfig__SelectLike: ${BLBL_Ray_DailyTaskConfig__SelectLike:-true} #投币同时点赞
# Ray_DailyTaskConfig__SupportUpIds: ${BLBL_Ray_DailyTaskConfig__SupportUpIds:-401876304} #优先支持的up主Id
# Ray_DailyTaskConfig__AutoChargeUpId: ${BLBL_Ray_DailyTaskConfig__AutoChargeUpId:--1} #充电对象;-1:自己
# Ray_Serilog__WriteTo__3__Args__botToken: ${BILI_TG_BOT_TOKEN}
# Ray_Serilog__WriteTo__3__Args__chatId: ${TG_CHAT_ID}
# IP_163: ${IP_163}
# TG_BOT_TOKEN_163: ${TG_BOT_TOKEN_163}
# TG_BOT_TOKEN: ${JD_TG_BOT_TOKEN} #已交由entrypoint处理
# JD_COOKIE: ${JD_COOKIE}
# JD_JOIN_ZLC: ${JD_JOIN_ZLC:-false} #是否加入互助
# JD_USER_AGENT:
# gua_cleancart_Run: ${gua_cleancart_Run:-true} #柠檬赚金币
# JD_TRY: ${JD_TRY:-true} #京东试用
# XFXD: ${XFXD:-true}
# cfd_rp: ${cfd_rp:-true}
# FS_LEVEL: ${FS_LEVEL:-car} #电脑配件
# MARKET_COIN_TO_BEANS: ${MARKET_COIN_TO_BEANS:-100} #东东超市兑换奖品
# PETSHARECODES: #东东萌宠互助码
# PLANT_BEAN_SHARECODES: #种豆得豆互助码
# DDFACTORY_SHARECODES: #东东工厂互助码
# JDSGMH_SHARECODES: #闪购盲盒互助码
# JDCFD_SHARECODES: #京喜财富岛互助码
# FRUITSHARECODES: #东东农场互助码
# JD_CASH_SHARECODES: #签到领现金互助码
# DREAM_FACTORY_SHARE_CODES: #京喜工厂互助码
# JDZZ_SHARECODES: #京东赚赚互助码
# JDJOY_SHARECODES: #疯狂的JOY互助码
# BOOKSHOP_SHARECODES: #京东书店互助码
# JXNC_SHARECODES: #京喜农场互助码
# dyjCode: #大赢家互助码
# TYT_PACKETID: #推一推互助码
# MONEYTREE_SHARECODES: #摇钱树互助码
# InviterPin: #柠檬赚金币邀请码
# SEVENDAY_LIST: #7天店铺签到
# JRBODY: #jd_bean_sign.js金融APP签到(需要cookie)
# DPQDTK: #店铺签到token
# volumes:
# - ${PWD}/data/tmp/qinglong/static/:/ql/static/dist/:rw #为了给nginx容器
# - /root/.ssh/id_rsa:/root/.ssh/id_rsa:ro #ssh私钥,用于github验证
# - /root/.ssh/known_hosts:/root/.ssh/known_hosts:ro #记录github服务器的白名单
# logging: *default-logging
# deploy:
# resources:
# limits:
# cpus: 1
# memory: 1024M
# networks:
# net1:
# ipv4_address: 172.1.1.89
# aliases:
# - qinglong
# - docker-qinglong
# jd:
# image: python:${python:-latest}
# container_name: jd
# hostname: docker-jd
# restart: always
# working_dir: /var
# command:
# - /bin/bash
# - -c
# - |
# curl -LO https://github.com/twbworld/JD-SHOPPER/archive/refs/heads/master.tar.gz
# tar -xzf master.tar.gz
# rm -f master.tar.gz
# mv JD-SHOPPER-master /var/jd
# cd /var/jd
# python -m pip install --upgrade pip
# pip install -r requirements.txt
# rm -f /var/jd/Config/config.ini
# ln -s /config.ini /var/jd/Config/config.ini
# python3 runserver.py
# environment:
# TZ: ${TZ:-Asia/Shanghai}
# volumes:
# - ${PWD}/data/tmp/jd/config.ini:/config.ini:rw
# - /etc/localtime:/etc/localtime:ro
# logging: *default-logging
# deploy:
# resources:
# limits:
# cpus: 1
# memory: 516M
# networks:
# net1:
# ipv4_address: 172.1.1.87
# aliases:
# - docker-jd