-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
98 lines (93 loc) · 2.78 KB
/
docker-compose.yml
File metadata and controls
98 lines (93 loc) · 2.78 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
services:
mongo:
image: mongo:6
restart: unless-stopped
ports:
- "${MONGO_PORT:-27017}:27017"
volumes:
- mongo-data:/data/db
environment:
- MONGO_INITDB_DATABASE=${MONGODB_DB_NAME:-mech}
healthcheck:
test: ["CMD", "mongosh", "--quiet", "--eval", "db.adminCommand('ping')"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
backend:
build:
context: ./backend
dockerfile: ../docker/backend.Dockerfile
ports:
- "${BACKEND_PORT:-4000}:${BACKEND_PORT:-4000}"
environment:
- MONGODB_URI=${MONGODB_URI:-mongodb://mongo:27017}
- MONGODB_DB_NAME=${MONGODB_DB_NAME:-mech}
- JWT_SECRET=${JWT_SECRET:-dev-secret}
- ADMIN_EMAIL=${ADMIN_EMAIL:-admin@admin.com}
- ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin}
- CLOUDINARY_NAME=${CLOUDINARY_NAME:-}
- CLOUDINARY_API_KEY=${CLOUDINARY_API_KEY:-}
- CLOUDINARY_SECRET_KEY=${CLOUDINARY_SECRET_KEY:-}
- STRIPE_SECRET_KEY=${STRIPE_SECRET_KEY:-}
- RAZORPAY_KEY_ID=${RAZORPAY_KEY_ID:-}
- RAZORPAY_KEY_SECRET=${RAZORPAY_KEY_SECRET:-}
- CURRENCY=${CURRENCY:-USD}
- PORT=${BACKEND_PORT:-4000}
- NODE_ENV=${NODE_ENV:-production}
depends_on:
mongo:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "node -e \"require('http').get('http://127.0.0.1:${BACKEND_PORT:-4000}/',r=>process.exit(r.statusCode===200?0:1)).on('error',()=>process.exit(1))\""]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
frontend:
build:
context: ./frontend
dockerfile: ../docker/frontend.Dockerfile
args:
- VITE_BACKEND_URL=${FRONTEND_BACKEND_URL:-/api}
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost/ >/dev/null 2>&1 || exit 1"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
admin:
build:
context: ./admin
dockerfile: ../docker/admin.Dockerfile
args:
- VITE_BACKEND_URL=${ADMIN_BACKEND_URL:-/api}
- VITE_BASE=/admin/
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost/admin/ >/dev/null 2>&1 || exit 1"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
nginx:
image: nginx:alpine
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
ports:
- "${NGINX_PORT:-8080}:80"
- "${NGINX_ADMIN_PORT:-8081}:8081"
depends_on:
backend:
condition: service_healthy
frontend:
condition: service_healthy
admin:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost/ >/dev/null 2>&1 || exit 1"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
volumes:
mongo-data: