-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
83 lines (78 loc) · 2.01 KB
/
Copy pathdocker-compose.yml
File metadata and controls
83 lines (78 loc) · 2.01 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
version: '3.8'
services:
# PostgreSQL数据库
postgres:
image: postgres:17.5
container_name: ai-interview-postgres
environment:
POSTGRES_DB: ai_interview_helper
POSTGRES_USER: postgres
POSTGRES_PASSWORD: root
POSTGRES_INITDB_ARGS: "--encoding=UTF8 --lc-collate=C --lc-ctype=C"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./backend/init.sql:/docker-entrypoint-initdb.d/init.sql
ports:
- "5432:5432"
networks:
- ai-interview-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d ai_interview_helper"]
interval: 30s
timeout: 10s
retries: 5
# Redis缓存
redis:
image: redis:7.4-alpine
container_name: ai-interview-redis
ports:
- "6379:6379"
networks:
- ai-interview-network
command: redis-server --appendonly yes
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 10s
retries: 5
# 后端API服务
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: ai-interview-backend
environment:
DATABASE_URL: postgresql://postgres:root@postgres:5432/ai_interview_helper
REDIS_URL: redis://redis:6379
SECRET_KEY: ai-interview-helper-secret-key-please-change-in-production-2024
ALGORITHM: HS256
ACCESS_TOKEN_EXPIRE_MINUTES: 30
CORS_ORIGINS: '["http://localhost:5173", "http://localhost:3000"]'
ports:
- "9000:9000"
networks:
- ai-interview-network
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
volumes:
- ./backend:/app
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/health"]
interval: 30s
timeout: 10s
retries: 5
start_period: 40s
volumes:
postgres_data:
driver: local
redis_data:
driver: local
networks:
ai-interview-network:
driver: bridge