-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
74 lines (69 loc) · 1.76 KB
/
Copy pathdocker-compose.prod.yml
File metadata and controls
74 lines (69 loc) · 1.76 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
version: '3.8'
services:
# MongoDB database
mongodb:
image: mongo:7-alpine
container_name: bodybuilding-db-prod
restart: always
environment:
MONGO_INITDB_ROOT_USERNAME: ${MONGO_ROOT_USER:-admin}
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_ROOT_PASSWORD:-change-me}
MONGO_INITDB_DATABASE: bodybuilding
volumes:
- mongodb_data:/data/db
- ./backups:/backups
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
interval: 10s
timeout: 5s
retries: 5
networks:
- bodybuilding-network
# Node.js Backend + Static Client
app:
build:
context: .
dockerfile: Dockerfile
container_name: bodybuilding-app-prod
restart: always
ports:
- "3000:3000"
environment:
NODE_ENV: production
PORT: 3000
MONGO_URI: mongodb://${MONGO_ROOT_USER:-admin}:${MONGO_ROOT_PASSWORD:-change-me}@mongodb:27017/bodybuilding?authSource=admin
JWT_SECRET: ${JWT_SECRET}
JWT_EXPIRES_IN: 7d
CLIENT_ORIGIN: https://${DOMAIN:-yourdomain.ir}
depends_on:
mongodb:
condition: service_healthy
healthcheck:
test: curl -f http://localhost:3000/api || exit 1
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
- bodybuilding-network
# Nginx Reverse Proxy + SSL
nginx:
image: nginx:alpine
container_name: bodybuilding-nginx
restart: always
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./ssl:/etc/nginx/ssl:ro
- ./logs/nginx:/var/log/nginx
depends_on:
- app
networks:
- bodybuilding-network
volumes:
mongodb_data:
networks:
bodybuilding-network:
driver: bridge