-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
78 lines (74 loc) · 1.95 KB
/
Copy pathdocker-compose.yml
File metadata and controls
78 lines (74 loc) · 1.95 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
# GridPilot 服务编排
# 默认(无 profile):仅启动 postgres + redis 基础设施(供本地开发)
# docker compose up -d
# 全栈一键部署(含 api + web):先确保根目录存在 .env,否则下方 env_file 会直接失败
# cp .env.example .env # 并把 ENCRYPTION_KEY 改为 `openssl rand -base64 32` 的真实输出
# docker compose --profile full up --build -d
services:
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: gridpilot
POSTGRES_PASSWORD: gridpilot
POSTGRES_DB: gridpilot
ports:
- "${DB_PORT:-25432}:5432"
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U gridpilot"]
interval: 5s
timeout: 3s
retries: 10
redis:
image: redis:7-alpine
command: redis-server --appendonly yes
ports:
- "${REDIS_PORT:-26379}:6379"
volumes:
- redisdata:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 10
api:
profiles: ["full"]
build:
context: .
dockerfile: apps/api/Dockerfile
env_file: .env
environment:
NODE_ENV: production
DATABASE_URL: postgresql://gridpilot:gridpilot@postgres:5432/gridpilot
REDIS_URL: redis://redis:6379
API_HOST: 0.0.0.0
API_PORT: 3301
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
ports:
- "${API_PORT:-3301}:3301"
web:
profiles: ["full"]
build:
context: .
dockerfile: apps/web/Dockerfile
args:
NEXT_PUBLIC_API_URL: http://localhost:${API_PORT:-3301}
NEXT_PUBLIC_API_PORT: ${API_PORT:-3301}
env_file: .env
environment:
NODE_ENV: production
API_URL: http://api:3301
PORT: 3300
HOSTNAME: 0.0.0.0
depends_on:
- api
ports:
- "${WEB_PORT:-3300}:3300"
volumes:
pgdata:
redisdata: