Repository navigation
Expand file tree
/
Copy pathdocker-compose.local.yml
More file actions
227 lines (217 loc) · 5.95 KB
/
Copy pathdocker-compose.local.yml
File metadata and controls
227 lines (217 loc) · 5.95 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
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
# 本地开发环境 - 全容器化,支持热重载
# 代理设置 — PROXY_URL 从 .env 读取,留空则不走代理
x-proxy-env: &proxy-env
HTTP_PROXY: ${PROXY_URL:-}
HTTPS_PROXY: ${PROXY_URL:-}
NO_PROXY: localhost,127.0.0.1,rsshub,browserless,postgres
services:
# ---- 基础设施 ----
postgres:
image: docker.m.daocloud.io/postgres:17-alpine
container_name: allin-dev-postgres
restart: unless-stopped
command: postgres -c timezone=UTC
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme}
TZ: UTC
ports:
- "5432:5432"
volumes:
- postgres_dev_data:/var/lib/postgresql/data
- ./scripts/init/init-databases.sql:/docker-entrypoint-initdb.d/init.sql:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
networks:
- allin-dev
# ---- 依赖服务 ----
rsshub:
image: docker.m.daocloud.io/diygod/rsshub:latest
container_name: allin-dev-rsshub
restart: unless-stopped
ports:
- "1200:1200"
env_file:
- ./.env
environment:
TZ: Asia/Shanghai
NODE_ENV: production
CACHE_TYPE: memory
CACHE_EXPIRE: 900
PUPPETEER_WS_ENDPOINT: ws://browserless:3000?token=${BROWSERLESS_TOKEN}
PROXY_URI: ${PROXY_URL:-}
depends_on:
browserless:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:1200/"]
interval: 10s
timeout: 5s
retries: 3
start_period: 30s
networks:
- allin-dev
browserless:
image: ghcr.io/browserless/chromium:latest # v2(v1 browserless/chrome 已停更)
container_name: allin-dev-browserless
restart: unless-stopped
deploy:
resources:
limits:
memory: 1g
ports:
- "3001:3000"
environment:
TZ: Asia/Shanghai
TOKEN: ${BROWSERLESS_TOKEN} # v2 强制鉴权,所有连接需带 ?token=
CONCURRENT: 3 # v1: MAX_CONCURRENT_SESSIONS
TIMEOUT: 30000 # v1: CONNECTION_TIMEOUT
QUEUED: 5 # v1: MAX_QUEUE_LENGTH
healthcheck:
# $$TOKEN 由容器内 shell 展开(双 $ 防止 compose 提前插值)
test: ["CMD-SHELL", "curl -fsS \"http://localhost:3000/pressure?token=$$TOKEN\" || exit 1"]
interval: 10s
timeout: 5s
retries: 3
start_period: 30s
networks:
- allin-dev
# ---- 应用服务 ----
backend:
build:
context: .
dockerfile: docker/Dockerfile.dev.backend
container_name: allin-dev-backend
restart: unless-stopped
ulimits:
nofile:
soft: 65536
hard: 65536
ports:
- "8000:8000"
volumes:
- ./backend:/app
- ./data:/app/data
- ${DOCKER_SOCK:-/var/run/docker.sock}:/var/run/docker.sock
- ./.env:/app/.env
- ./docker-compose.local.yml:/project/docker-compose.yml:ro
- ./.env:/project/.env
env_file:
- ./.env
environment:
TZ: Asia/Shanghai
DATABASE_URL: postgresql://allinone:allinone@postgres:5432/allinone
# 覆盖 .env 中的地址,使用 Docker 内部网络
RSSHUB_URL: http://rsshub:1200
BROWSERLESS_URL: http://browserless:3000
BROWSERLESS_TOKEN: ${BROWSERLESS_TOKEN}
# macOS Docker bind mount 不传递 inotify 事件,需要轮询
WATCHFILES_FORCE_POLLING: "true"
<<: *proxy-env
depends_on:
postgres:
condition: service_healthy
rsshub:
condition: service_healthy
browserless:
condition: service_healthy
networks:
- allin-dev
frontend:
build:
context: .
dockerfile: docker/Dockerfile.dev.frontend
container_name: allin-dev-frontend
restart: unless-stopped
ulimits:
nofile:
soft: 65536
hard: 65536
ports:
- "3000:3000"
volumes:
- ./frontend:/app
- /app/node_modules
environment:
TZ: Asia/Shanghai
API_BASE_URL: http://backend:8000
depends_on:
backend:
condition: service_started
networks:
- allin-dev
worker-pipeline:
build:
context: .
dockerfile: docker/Dockerfile.dev.backend
container_name: allin-dev-worker-pipeline
restart: unless-stopped
ulimits:
nofile:
soft: 65536
hard: 65536
command: ["python", "dev_worker.py", "pipeline"]
volumes:
- ./backend:/app
- ./data:/app/data
env_file:
- ./.env
environment:
TZ: Asia/Shanghai
DATABASE_URL: postgresql://allinone:allinone@postgres:5432/allinone
RSSHUB_URL: http://rsshub:1200
BROWSERLESS_URL: http://browserless:3000
BROWSERLESS_TOKEN: ${BROWSERLESS_TOKEN}
WATCHFILES_FORCE_POLLING: "true"
<<: *proxy-env
depends_on:
postgres:
condition: service_healthy
rsshub:
condition: service_healthy
browserless:
condition: service_healthy
networks:
- allin-dev
worker-scheduled:
build:
context: .
dockerfile: docker/Dockerfile.dev.backend
container_name: allin-dev-worker-scheduled
restart: unless-stopped
ulimits:
nofile:
soft: 65536
hard: 65536
command: ["python", "dev_worker.py", "scheduled"]
volumes:
- ./backend:/app
- ./data:/app/data
env_file:
- ./.env
environment:
TZ: Asia/Shanghai
DATABASE_URL: postgresql://allinone:allinone@postgres:5432/allinone
RSSHUB_URL: http://rsshub:1200
BROWSERLESS_URL: http://browserless:3000
BROWSERLESS_TOKEN: ${BROWSERLESS_TOKEN}
WATCHFILES_FORCE_POLLING: "true"
<<: *proxy-env
depends_on:
postgres:
condition: service_healthy
rsshub:
condition: service_healthy
browserless:
condition: service_healthy
networks:
- allin-dev
networks:
allin-dev:
driver: bridge
volumes:
postgres_dev_data:
driver: local