-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathdocker-compose.build.yml
More file actions
60 lines (57 loc) · 2.03 KB
/
Copy pathdocker-compose.build.yml
File metadata and controls
60 lines (57 loc) · 2.03 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
services:
rote-backend:
build:
context: ./server
dockerfile: Dockerfile
environment:
# 基础配置 - 必需
- POSTGRESQL_URL=postgresql://rote:${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env before first start}@rote-postgres:5432/rote
ports:
- "18000:3000"
depends_on:
rote-postgres:
condition: service_healthy
restart: unless-stopped
# 启动命令:等待数据库就绪后执行数据库迁移并启动服务
# 使用程序化迁移(不依赖 drizzle-kit CLI,适用于生产环境)
command:
[
"sh",
"-c",
"sleep 15 && bun run dist/scripts/runMigrations.js && bun run dist/server.js",
]
rote-frontend:
build:
context: ./web
dockerfile: Dockerfile
args:
# 构建时传递 VITE_API_BASE(构建时注入到代码中)
- VITE_API_BASE=${VITE_API_BASE:?Set VITE_API_BASE to your public backend URL, for example http://your-domain.com}
ports:
- "18001:80"
depends_on:
- rote-backend
environment:
# 运行时环境变量,用于启动脚本注入配置(如果需要覆盖构建时配置)
- VITE_API_BASE=${VITE_API_BASE:?Set VITE_API_BASE to your public backend URL, for example http://your-domain.com}
restart: unless-stopped
rote-postgres:
# pgvector image keeps Postgres 17 behavior and adds the optional vector extension.
# Plain postgres:17 is a compatibility-only path and may not be supported by future Rote versions.
image: ${POSTGRES_IMAGE:-pgvector/pgvector:pg17-trixie}
container_name: rote-postgres
restart: unless-stopped
environment:
POSTGRES_USER: rote
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env before first start}
POSTGRES_DB: rote
volumes:
- rote-postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U rote -d rote"]
interval: 5s
timeout: 3s
retries: 10
start_period: 30s
volumes:
rote-postgres-data: