generated from jarvis394/nestjs-prisma-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
218 lines (203 loc) · 4.07 KB
/
docker-compose.yml
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
x-defaults: &defaults
init: true
tty: true
logging:
driver: 'json-file'
options:
max-size: '20m'
max-file: '3'
networks:
- valley_network
# Settings and configurations that are common for all containers
x-minio-common: &minio-common
image: minio/minio
command: server --console-address ":9001" http://minio{1...4}/data{1...2}
expose:
- '9000'
- '9001'
env_file:
- .env
healthcheck:
test: ['CMD', 'mc', 'ready', 'local']
interval: 5s
timeout: 5s
retries: 5
logging:
driver: 'json-file'
options:
max-size: '20m'
max-file: '3'
init: true
tty: true
networks:
- valley_network
name: valley
services:
web:
<<: *defaults
container_name: valley-web
env_file:
- .env
ports:
- '${WEB_PORT}:${WEB_PORT}'
command: turbo run start --filter web
build:
args:
APP: web
START_COMMAND: start
context: .
dockerfile: ./Dockerfile
depends_on:
- postgres
- redis
volumes:
- .env:/app/.env
gallery:
<<: *defaults
container_name: valley-gallery
env_file:
- .env
ports:
- '${GALLERY_PORT}:${GALLERY_PORT}'
command: turbo run start --filter gallery
build:
args:
APP: gallery
START_COMMAND: start
context: .
dockerfile: ./Dockerfile
depends_on:
- postgres
- redis
volumes:
- .env:/app/.env
upload:
<<: *defaults
container_name: valley-upload
env_file:
- .env
ports:
- '${UPLOAD_SERVICE_PORT}:${UPLOAD_SERVICE_PORT}'
command: turbo run start --filter upload
build:
args:
APP: upload
START_COMMAND: start
context: .
dockerfile: ./Dockerfile
depends_on:
- postgres
- redis
volumes:
- .env:/app/.env
minio1:
<<: *minio-common
hostname: minio1
volumes:
- data1-1:/data1
- data1-2:/data2
minio2:
<<: *minio-common
hostname: minio2
volumes:
- data2-1:/data1
- data2-2:/data2
minio3:
<<: *minio-common
hostname: minio3
volumes:
- data3-1:/data1
- data3-2:/data2
minio4:
<<: *minio-common
hostname: minio4
volumes:
- data4-1:/data1
- data4-2:/data2
postgres:
<<: *defaults
container_name: valley-postgres
image: postgres:16-alpine
env_file:
- .env
environment:
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
volumes:
- pgdata:/var/lib/postgresql/data
- ./postgres:/docker-entrypoint-initdb.d
ports:
- '5432:5432'
restart: always
healthcheck:
test: ['CMD', 'pg_isready -d valley -U ${DB_USER}']
interval: 5s
timeout: 5s
retries: 10
redis:
<<: *defaults
container_name: valley-redis
image: redis:latest
env_file:
- .env
restart: always
ports:
- '6379:6379'
environment:
- REDIS_PORT=6379
- REDIS_DATABASES=16
nginx:
<<: *defaults
image: nginx:1.19.2-alpine
hostname: nginx
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
ports:
- '9000:9000'
- '9001:9001'
depends_on:
- minio1
- minio2
- minio3
- minio4
prisma-migrate:
<<: *defaults
image: node:22-alpine3.19
env_file:
- .env
depends_on:
- postgres
build:
context: .
dockerfile: ./packages/database/Dockerfile
# Creates minio bucket on startup if it was not created before
createbuckets:
<<: *defaults
image: minio/mc:latest
env_file:
- .env
depends_on:
- minio1
- minio2
- minio3
- minio4
- nginx
entrypoint: >
/bin/sh -c "
/usr/bin/mc config host add myminio http://nginx:9000 ${MINIO_ROOT_USER} ${MINIO_ROOT_PASSWORD};
/usr/bin/mc mb myminio/${AWS_BUCKET};
/usr/bin/mc anonymous set private myminio/${AWS_BUCKET};
exit 0;
"
volumes:
data1-1:
data1-2:
data2-1:
data2-2:
data3-1:
data3-2:
data4-1:
data4-2:
pgdata:
networks:
valley_network: