-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
103 lines (96 loc) · 3.37 KB
/
docker-compose.yml
File metadata and controls
103 lines (96 loc) · 3.37 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
version: '3.9'
# Full-Stack Docker Compose
# Orchestrates: MongoDB + Authentication Microservice + API Gateway + Frontend
services:
# ─────────────────────────────────────────────
# Database
# ─────────────────────────────────────────────
mongodb:
image: mongo:8
container_name: app-mongodb
environment:
MONGO_INITDB_DATABASE: auth-app
ports:
- '27017:27017'
volumes:
- mongodb_data:/data/db
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
interval: 10s
timeout: 5s
retries: 5
networks:
- app-network
restart: unless-stopped
# ─────────────────────────────────────────────
# Authentication Microservice (TCP on port 3001)
# ─────────────────────────────────────────────
authentication:
build:
context: ./backend
dockerfile: docker/Dockerfile.authentication
container_name: app-auth
environment:
NODE_ENV: production
MONGODB_URI: mongodb://mongodb:27017/auth-app
JWT_SECRET: ${JWT_SECRET:-super-secret-jwt-key-change-in-production}
JWT_EXPIRATION: ${JWT_EXPIRATION:-3600}
AUTH_SERVICE_HOST: 0.0.0.0
AUTH_SERVICE_PORT: 3001
ports:
- '3001:3001'
depends_on:
mongodb:
condition: service_healthy
networks:
- app-network
restart: unless-stopped
# ─────────────────────────────────────────────
# API Gateway (HTTP on port 3000)
# ─────────────────────────────────────────────
gateway:
build:
context: ./backend
dockerfile: docker/Dockerfile.gateway
container_name: app-gateway
environment:
NODE_ENV: production
GATEWAY_PORT: 3000
MONGODB_URI: mongodb://mongodb:27017/auth-app
JWT_SECRET: ${JWT_SECRET:-super-secret-jwt-key-change-in-production}
JWT_EXPIRATION: ${JWT_EXPIRATION:-3600}
AUTH_SERVICE_HOST: authentication
AUTH_SERVICE_PORT: 3001
THROTTLE_TTL: ${THROTTLE_TTL:-60}
THROTTLE_LIMIT: ${THROTTLE_LIMIT:-10}
ports:
- '3000:3000'
depends_on:
- authentication
- mongodb
networks:
- app-network
restart: unless-stopped
# ─────────────────────────────────────────────
# Frontend (Next.js on port 3001 → mapped to 8080)
# ─────────────────────────────────────────────
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: app-frontend
environment:
NEXT_PUBLIC_API_URL: http://gateway:3000
ports:
- '8080:3000'
depends_on:
- gateway
networks:
- app-network
restart: unless-stopped
volumes:
mongodb_data:
driver: local
networks:
app-network:
driver: bridge