-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
137 lines (130 loc) · 3.08 KB
/
docker-compose.prod.yml
File metadata and controls
137 lines (130 loc) · 3.08 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
version: '3.8'
services:
# Database
db:
image: mysql:8.0
container_name: news_aggregator_db_prod
restart: unless-stopped
environment:
MYSQL_DATABASE: news_aggregator
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
MYSQL_USER: ${DB_USERNAME}
MYSQL_PASSWORD: ${DB_PASSWORD}
volumes:
- db_data:/var/lib/mysql
networks:
- app_network
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
timeout: 20s
retries: 10
deploy:
resources:
limits:
memory: 1G
# Cache & Sessions
redis:
image: redis:7-alpine
container_name: news_aggregator_redis_prod
restart: unless-stopped
networks:
- app_network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
timeout: 5s
retries: 5
deploy:
resources:
limits:
memory: 256M
# Laravel Backend
backend:
build:
context: ./backend
dockerfile: Dockerfile.prod
container_name: news_aggregator_backend_prod
restart: unless-stopped
working_dir: /var/www
networks:
- app_network
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
environment:
- APP_ENV=production
- APP_DEBUG=false
- DB_HOST=db
- DB_DATABASE=${DB_DATABASE}
- DB_USERNAME=${DB_USERNAME}
- DB_PASSWORD=${DB_PASSWORD}
- REDIS_HOST=redis
- REDIS_PORT=6379
- MAIL_MAILER=${MAIL_MAILER}
- MAIL_HOST=${MAIL_HOST}
- MAIL_PORT=${MAIL_PORT}
- MAIL_USERNAME=${MAIL_USERNAME}
- MAIL_PASSWORD=${MAIL_PASSWORD}
- MAIL_ENCRYPTION=${MAIL_ENCRYPTION}
- MAIL_FROM_ADDRESS=${MAIL_FROM_ADDRESS}
- MAIL_FROM_NAME=${MAIL_FROM_NAME}
healthcheck:
test: ["CMD", "php", "artisan", "--version"]
timeout: 10s
retries: 5
deploy:
resources:
limits:
memory: 512M
# Nginx for Backend API
nginx:
image: nginx:alpine
container_name: news_aggregator_nginx_prod
restart: unless-stopped
ports:
- "8000:80"
volumes:
- ./backend:/var/www
- ./backend/nginx.prod.conf:/etc/nginx/conf.d/default.conf
networks:
- app_network
depends_on:
- backend
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost/health"]
timeout: 5s
retries: 5
deploy:
resources:
limits:
memory: 128M
# React Frontend (Production)
frontend:
build:
context: ./frontend
dockerfile: Dockerfile.prod
container_name: news_aggregator_frontend_prod
restart: unless-stopped
ports:
- "3000:80"
networks:
- app_network
environment:
- NODE_ENV=production
- VITE_API_BASE_URL=${API_BASE_URL}
depends_on:
- nginx
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost"]
timeout: 10s
retries: 5
deploy:
resources:
limits:
memory: 256M
volumes:
db_data:
networks:
app_network:
driver: bridge