-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
106 lines (99 loc) · 2.38 KB
/
docker-compose.yml
File metadata and controls
106 lines (99 loc) · 2.38 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
version: '3.8'
services:
# MongoDB Database
mongodb:
image: mongo:7-jammy
restart: unless-stopped
ports:
- "27017:27017"
environment:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: password
MONGO_INITDB_DATABASE: recipegenius
volumes:
- mongodb_data:/data/db
- ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
networks:
- recipegenius-network
# Backend API
backend:
build:
context: ./backend
dockerfile: Dockerfile
restart: unless-stopped
ports:
- "5000:5000"
environment:
- NODE_ENV=production
- PORT=5000
- MONGODB_URI=mongodb://admin:password@mongodb:27017/recipegenius?authSource=admin
- CLERK_PUBLISHABLE_KEY=${CLERK_PUBLISHABLE_KEY}
- CLERK_SECRET_KEY=${CLERK_SECRET_KEY}
- SPOONACULAR_API_KEY=${SPOONACULAR_API_KEY}
depends_on:
- mongodb
volumes:
- ./backend:/app
- /app/node_modules
networks:
- recipegenius-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5000/health"]
interval: 30s
timeout: 10s
retries: 3
# Frontend React App
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
restart: unless-stopped
ports:
- "3000:80"
environment:
- REACT_APP_API_URL=http://localhost:5000
- REACT_APP_CLERK_PUBLISHABLE_KEY=${CLERK_PUBLISHABLE_KEY}
- REACT_APP_SPOONACULAR_API_KEY=${SPOONACULAR_API_KEY}
depends_on:
- backend
networks:
- recipegenius-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/health"]
interval: 30s
timeout: 10s
retries: 3
# Redis for caching (optional)
redis:
image: redis:7-alpine
restart: unless-stopped
ports:
- "6379:6379"
volumes:
- redis_data:/data
networks:
- recipegenius-network
command: redis-server --appendonly yes
# Nginx Reverse Proxy
nginx:
image: nginx:alpine
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/ssl:/etc/nginx/ssl:ro
depends_on:
- frontend
- backend
networks:
- recipegenius-network
volumes:
mongodb_data:
driver: local
redis_data:
driver: local
networks:
recipegenius-network:
driver: bridge