-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
121 lines (114 loc) · 2.84 KB
/
docker-compose.yml
File metadata and controls
121 lines (114 loc) · 2.84 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
version: '3.8'
services:
postgres:
image: postgres:15-alpine
container_name: mp-publisher-postgres
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: mp_publisher
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
networks:
- mp-network
redis:
image: redis:7-alpine
container_name: mp-publisher-redis
ports:
- "6379:6379"
volumes:
- redis_data:/data
command: redis-server --appendonly yes
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- mp-network
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: mp-publisher-backend
environment:
NODE_ENV: development
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/mp_publisher
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET:-dev-secret-change-this-in-production-min-64-chars-1234567890}
ENCRYPTION_KEY: ${ENCRYPTION_KEY:-32-byte-encryption-key-for-dev-only-1234}
OPENROUTER_API_KEY: ${OPENROUTER_API_KEY:-}
LOG_LEVEL: debug
CORS_ORIGIN: http://localhost:5173
ports:
- "3000:3000"
volumes:
- ./backend:/usr/src/app
- /usr/src/app/node_modules
- /usr/src/app/dist
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
command: npm run start:dev
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
interval: 30s
timeout: 10s
retries: 3
networks:
- mp-network
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: mp-publisher-frontend
environment:
VITE_API_URL: http://localhost:3000/api/v1
ports:
- "5173:5173"
volumes:
- ./frontend:/usr/src/app
- /usr/src/app/node_modules
- /usr/src/app/dist
depends_on:
- backend
command: npm run dev -- --host 0.0.0.0 --port 5173
networks:
- mp-network
# Optional: PgAdmin for database management
pgadmin:
image: dpage/pgadmin4
container_name: mp-publisher-pgadmin
environment:
PGADMIN_DEFAULT_EMAIL: admin@example.com
PGADMIN_DEFAULT_PASSWORD: admin
PGADMIN_LISTEN_PORT: 80
ports:
- "5050:80"
volumes:
- pgadmin_data:/var/lib/pgadmin
depends_on:
- postgres
networks:
- mp-network
profiles:
- tools # 使用 `docker-compose --profile tools up` 启动
volumes:
postgres_data:
driver: local
redis_data:
driver: local
pgadmin_data:
driver: local
networks:
mp-network:
driver: bridge