-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
61 lines (58 loc) · 1.9 KB
/
Copy pathdocker-compose.yml
File metadata and controls
61 lines (58 loc) · 1.9 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
services:
postgres:
image: postgres:14
container_name: graphnote-postgres
environment:
POSTGRES_USER: graphnote_user
POSTGRES_PASSWORD: graphnote_password
POSTGRES_DB: graphnote
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U graphnote_user -d graphnote"]
interval: 5s
timeout: 3s
retries: 10
backend:
build:
context: .
dockerfile: backend/Dockerfile
container_name: graphnote-backend
# 启动前先执行数据库迁移
command: ["sh", "-c", "npx prisma migrate deploy && node dist/main.js"]
environment:
NODE_ENV: production
PORT: 3000
DATABASE_URL: postgresql://graphnote_user:graphnote_password@postgres:5432/graphnote
# 生产环境必须设置 JWT_SECRET,可用 openssl rand -hex 32 生成
JWT_SECRET: ${JWT_SECRET:-please-change-me}
JWT_EXPIRATION: ${JWT_EXPIRATION:-1h}
JWT_REFRESH_EXPIRATION: ${JWT_REFRESH_EXPIRATION:-7d}
CORS_ORIGIN: ${CORS_ORIGIN:-http://localhost:8080}
# LLM 配置(OpenAI 兼容格式,可指向官方或第三方兼容服务)
LLM_API_KEY: ${LLM_API_KEY:-}
LLM_BASE_URL: ${LLM_BASE_URL:-https://api.openai.com/v1}
LLM_MODEL: ${LLM_MODEL:-gpt-4.1-nano}
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD", "node", "-e", "fetch('http://localhost:3000/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"]
interval: 10s
timeout: 5s
retries: 5
start_period: 15s
frontend:
build:
context: ./graphnote-web
args:
# 构建时注入相对路径,由 nginx 反代到 backend 服务
VITE_API_BASE_URL: /api
container_name: graphnote-frontend
ports:
- "8080:80"
depends_on:
backend:
condition: service_healthy
volumes:
postgres_data: