-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
76 lines (71 loc) · 1.67 KB
/
docker-compose.yml
File metadata and controls
76 lines (71 loc) · 1.67 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
version: '3.8'
services:
# 主应用服务
app:
build:
context: .
dockerfile: Dockerfile
target: runner
ports:
- "3000:3000"
environment:
- NODE_ENV=production
- DATABASE_URL=file:/app/data/database.db
- NEXT_PUBLIC_BASE_URL=http://localhost:3000
- ENCRYPTION_KEY=your-secret-encryption-key-here
- NEXT_TELEMETRY_DISABLED=1
# 性能优化环境变量
- DB_MAX_CONNECTIONS=10
- DB_CONNECTION_TIMEOUT=5000
- DB_IDLE_TIMEOUT=300000
- CACHE_TTL=300000
- API_RATE_LIMIT=100
volumes:
- ./data:/app/data
- ./logs:/app/logs
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/api/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
reservations:
memory: 256M
cpus: '0.25'
networks:
- app_network
# Nginx 反向代理(可选,用于生产环境)
nginx:
image: nginx:alpine
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./ssl:/etc/nginx/ssl:ro
- nginx_cache:/var/cache/nginx
depends_on:
- app
restart: unless-stopped
networks:
- app_network
profiles:
- production
volumes:
app_data:
driver: local
app_logs:
driver: local
nginx_cache:
driver: local
networks:
app_network:
driver: bridge
# 注释掉默认的 PostgreSQL 配置
# 如需使用 PostgreSQL,请使用:docker-compose -f docker-compose.yml -f docker-compose.postgres.yml up -d