-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompose.yaml
89 lines (83 loc) · 1.88 KB
/
compose.yaml
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
services:
load-balancer:
container_name: load-balancer
image: nginx:1.27-alpine
restart: unless-stopped
ports:
- 8080:80
volumes:
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
networks:
- backend-network
depends_on:
- ws-1
- ws-2
ws-1:
build: .
profiles: ["server", "DB"]
container_name: ws-1
environment:
NODE_ENV: ${NODE_ENV}
DB_USER: ${DB_USER}
DB_PASSWORD: ${DB_PASSWORD}
DB_PORT: ${DB_PORT}
DB_DATABASE: ${DB_DATABASE}
DB_HOST: ${DB_HOST}
ports:
- 8081:3000
# The commented out section below is an example of how to define a PostgreSQL
# database that your application can use. `depends_on` tells Docker Compose to
# start the database before your application.
depends_on:
db:
condition: service_healthy
networks:
- backend-network
ws-2:
build: .
profiles: ["server", "DB"]
container_name: ws-2
environment:
NODE_ENV: ${NODE_ENV}
DB_USER: ${DB_USER}
DB_PASSWORD: ${DB_PASSWORD}
DB_PORT: ${DB_PORT}
DB_DATABASE: ${DB_DATABASE}
DB_HOST: ${DB_HOST}
ports:
- 8082:3000
depends_on:
db:
condition: service_healthy
networks:
- backend-network
db:
image: postgres:14-alpine
profiles: ["DB"]
restart: unless-stopped
user: postgres
secrets:
- db-password
volumes:
- dbdata:/var/lib/postgresql/data
environment:
- POSTGRES_DB=${DB_DATABASE}
- POSTGRES_PASSWORD_FILE=/run/secrets/db-password
# - POSTGRES_USER=${DB_USER}
expose:
- 5432
networks:
- backend-network
healthcheck:
test: ["CMD", "pg_isready"]
interval: 10s
timeout: 5s
retries: 5
volumes:
dbdata:
secrets:
db-password:
file: db/password.txt
networks:
backend-network:
driver: bridge