Repository navigation
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
70 lines (65 loc) · 1.7 KB
/
Copy pathdocker-compose.yaml
File metadata and controls
70 lines (65 loc) · 1.7 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
services:
mysql:
image: mysql:8.0
environment:
MYSQL_ROOT_PASSWORD: password
ports:
- "3306:3306"
volumes:
- mysql_data:/var/lib/mysql
- ./init-db.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 10s
timeout: 5s
retries: 5
auth-service:
build: ./services/auth-service
ports:
- "3001:3001"
environment:
PORT: 3001
DATABASE_URL: mysql://root:password@mysql:3306/auth_db
JWT_SECRET: dev-secret-key
depends_on:
mysql:
condition: service_healthy
command: sh -c "npx prisma db push --skip-generate && node dist/index.js"
post-service:
build: ./services/post-service
ports:
- "3002:3002"
environment:
PORT: 3002
DATABASE_URL: mysql://root:password@mysql:3306/posts_db
AUTH_SERVICE_URL: http://auth-service:3001
depends_on:
mysql:
condition: service_healthy
auth-service:
condition: service_started
command: sh -c "npx prisma db push --skip-generate && node dist/index.js"
comment-service:
build: ./services/comment-service
ports:
- "3003:3003"
environment:
PORT: 3003
DATABASE_URL: mysql://root:password@mysql:3306/comments_db
AUTH_SERVICE_URL: http://auth-service:3001
depends_on:
mysql:
condition: service_healthy
auth-service:
condition: service_started
command: sh -c "npx prisma db push --skip-generate && node dist/index.js"
frontend:
build: ./frontend
ports:
- "80:80"
depends_on:
- auth-service
- post-service
- comment-service
volumes:
mysql_data: