-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
144 lines (138 loc) · 3.89 KB
/
docker-compose.yml
File metadata and controls
144 lines (138 loc) · 3.89 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
services:
# ============================================
# 应用服务
# ============================================
intellipick-api:
build:
context: .
dockerfile: apps/api/Dockerfile
container_name: intellipick-api
restart: unless-stopped
depends_on:
intellipick-db:
condition: service_healthy
intellipick-redis:
condition: service_started
env_file:
- .env.production
extra_hosts:
- "host.docker.internal:host-gateway"
ports:
- "8085:3000"
networks:
- intellipick-network
# 日志配置:限制单个日志文件大小和数量
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
intellipick-worker:
build:
context: .
dockerfile: apps/worker/Dockerfile
container_name: intellipick-worker
restart: unless-stopped
depends_on:
intellipick-db:
condition: service_healthy
intellipick-redis:
condition: service_started
intellipick-rsshub:
condition: service_healthy
env_file:
- .env.production
extra_hosts:
- "host.docker.internal:host-gateway"
networks:
- intellipick-network
# 日志配置:限制单个日志文件大小和数量
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# ============================================
# PostgreSQL 数据库
# ============================================
intellipick-db:
image: postgres:16-alpine
container_name: intellipick-db
restart: unless-stopped
ports:
- "${DB_PORT_MAPPING:-15432:5432}" # 暴露数据库到宿主机端口
environment:
POSTGRES_DB: ${POSTGRES_DB:-intellipick}
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-123456}
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- intellipick-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d intellipick"]
interval: 10s
timeout: 5s
retries: 5
# ============================================
# Redis 缓存
# ============================================
intellipick-redis:
image: redis:7-alpine
container_name: intellipick-redis
restart: unless-stopped
command: redis-server --appendonly yes
volumes:
- redis_data:/data
networks:
- intellipick-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
# ============================================
# RSSHub - RSS 生成服务
# ============================================
intellipick-rsshub:
image: diygod/rsshub:chromium-bundled
container_name: intellipick-rsshub
restart: unless-stopped
ports:
- '1200:1200'
depends_on:
intellipick-redis:
condition: service_healthy
env_file:
- .env.production
environment:
NODE_ENV: production
CACHE_TYPE: redis
# 使用生产环境的 Redis(在 Docker 网络中通过服务名访问)
REDIS_URL: 'redis://intellipick-redis:6379/'
# 代理配置(访问外网需要)
HTTP_PROXY: 'http://host.docker.internal:7890'
HTTPS_PROXY: 'http://host.docker.internal:7890'
NO_PROXY: 'localhost,127.0.0.1,intellipick-redis,intellipick-db,intellipick-app'
networks:
- intellipick-network
healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:1200/healthz']
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# ============================================
# 网络配置
# ============================================
networks:
intellipick-network:
driver: bridge
# ============================================
# 数据卷
# ============================================
volumes:
postgres_data:
driver: local
redis_data:
driver: local