-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
198 lines (191 loc) · 5.09 KB
/
docker-compose.yml
File metadata and controls
198 lines (191 loc) · 5.09 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
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
services:
db:
image: postgres:16
container_name: q_database
environment:
POSTGRES_DB: ${POSTGRES_DB:-mydb}
POSTGRES_USER: ${POSTGRES_USER:-myuser}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-mypass}
volumes:
- pgdata:/var/lib/postgresql/data
networks:
- q_net
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "3"
tag: "{{.Name}}"
healthcheck:
test:
[
"CMD-SHELL",
"pg_isready -U ${POSTGRES_USER:-myuser} -d ${POSTGRES_DB:-mydb}",
]
interval: 5s
retries: 5
start_period: 5s
pgadmin:
image: dpage/pgadmin4
container_name: q_pgadmin
environment:
PGADMIN_DEFAULT_EMAIL: admin@admin.com
PGADMIN_DEFAULT_PASSWORD: admin
PGADMIN_CONFIG_SERVER_MODE: "False"
PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: "False"
PGADMIN_REPLACE_SERVERS_ON_STARTUP: "True"
PGPASSFILE: /config/pgpass
SCRIPT_NAME: /pgadmin
configs:
- source: pgadmin-pgpass
target: /config/pgpass
uid: "5050"
gid: "5050"
mode: 0400
- source: pgadmin-servers
target: /pgadmin4/servers.json
mode: 0444
ports:
- "8081:80"
networks:
- app-network
- q_net
depends_on:
db:
condition: service_healthy
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "3"
tag: "{{.Name}}"
frontend:
build:
context: . # Build context at workspace root for npm workspaces
dockerfile: ./frontend/Dockerfile.dev
container_name: frontend
restart: unless-stopped
user: root
command: sh -c "cd /app && npm ci && chown -R node:node /app/node_modules /app/frontend/node_modules && cd /app/frontend && su node -c 'npm run dev'"
ports:
- "3000:3000"
volumes:
- ./frontend:/app/frontend # Mount only frontend source code
- frontend_node_modules:/app/node_modules # Workspace node_modules
- frontend_local_node_modules:/app/frontend/node_modules # Frontend local node_modules
working_dir: /app/frontend
healthcheck:
test:
[
"CMD",
"wget",
"--no-verbose",
"--tries=1",
"--spider",
"http://localhost:3000",
]
interval: 10s
timeout: 5s
retries: 5
start_period: 60s
networks:
- app-network
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "3"
tag: "{{.Name}}"
backend:
build:
context: . # Build context at workspace root for npm workspaces
dockerfile: ./backend/Dockerfile.dev
container_name: backend
restart: unless-stopped
environment:
NODE_ENV: development
POSTGRES_USER: ${POSTGRES_USER:-myuser}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-mypass}
POSTGRES_DB: ${POSTGRES_DB:-mydb}
POSTGRES_HOST: db
POSTGRES_PORT: ${POSTGRES_PORT:-5432}
ACCESS_TOKEN_SECRET: ${ACCESS_TOKEN_SECRET:-ceciestmonsecretetcestungrossecret}
REFRESH_TOKEN_SECRET: ${REFRESH_TOKEN_SECRET:-ceciestmonsecretetcestungrossecretrefresh}
ports:
- "3001:3000"
depends_on:
db:
condition: service_healthy
networks:
- app-network
- q_net
volumes:
- ./backend:/app/backend # Mount only backend source code
- backend_node_modules:/app/node_modules # Workspace node_modules
- backend_local_node_modules:/app/backend/node_modules # Backend local node_modules
working_dir: /app/backend
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "3"
tag: "{{.Name}}"
command: >
sh -c "
npx sequelize-cli db:migrate &&
npx sequelize-cli db:seed:all &&
npm start
"
nginx:
image: nginx:latest
ports:
- "80:80"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/conf.d:/etc/nginx/conf.d:ro
depends_on:
backend:
condition: service_started
frontend:
condition: service_healthy
pgadmin:
condition: service_started
networks:
- app-network
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "3"
tag: "{{.Name}}"
volumes:
backend_node_modules: # Workspace root node_modules for backend
backend_local_node_modules: # Backend-specific node_modules
frontend_node_modules: # Workspace root node_modules for frontend
frontend_local_node_modules: # Frontend-specific node_modules
pgdata:
networks:
q_net:
app-network:
driver: bridge
configs:
pgadmin-servers:
content: |
{
"Servers": {
"1": {
"Name": "QuantumTrader DB",
"Group": "PostgreSQL",
"Host": "db",
"Port": 5432,
"MaintenanceDB": "mydb",
"Username": "myuser",
"SSLMode": "prefer",
"PassFile": "/config/pgpass"
}
}
}
pgadmin-pgpass:
content: |
db:5432:mydb:myuser:mypass