-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.main.yml
More file actions
90 lines (85 loc) · 2.39 KB
/
docker-compose.main.yml
File metadata and controls
90 lines (85 loc) · 2.39 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
services:
db:
image: postgres:14-bullseye
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
ports:
- "5455:5432" # Разный порт для main, чтобы не конфликтовать с dev
volumes:
- postgres_data_main:/var/lib/postgresql/data
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 10
redis:
image: redis:latest
ports:
- "6379:6379"
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 10
migrations:
build:
context: .
dockerfile: Dockerfile.frontend
command: >
sh -c "
npx prisma migrate deploy &&
redis-cli -h redis flushall &&
npx tsx server/tools/init-chains.ts &&
npx prisma migrate dev
"
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
environment:
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}?schema=public
volumes:
- uploads_data:/app/uploads
frontend:
build:
context: .
dockerfile: Dockerfile.frontend
ports:
- "4000:3000"
depends_on:
migrations:
condition: service_completed_successfully
redis:
condition: service_healthy
environment:
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}?schema=public
SERVER_PORT: "3000"
PUBLIC_URL: ${PUBLIC_URL}
volumes:
- uploads_data:/app/uploads
indexer:
build:
context: .
dockerfile: Dockerfile.indexer
ports:
- "4001:3001"
depends_on:
migrations:
condition: service_completed_successfully
redis:
condition: service_healthy
environment:
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}?schema=public
INDEXER_PORT: "3001"
REDIS_HOST: redis
REDIS_PORT: "6379"
volumes:
- uploads_data:/app/uploads # 👈 общий volume для сохранения файлов
volumes:
postgres_data_main:
uploads_data: # 👈 именованный volume для изображений