-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
161 lines (152 loc) · 3.63 KB
/
docker-compose.yml
File metadata and controls
161 lines (152 loc) · 3.63 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
version: '3.8'
services:
# Main Database
db:
image: mysql:8.0
container_name: news_aggregator_db
restart: unless-stopped
environment:
MYSQL_DATABASE: news_aggregator
MYSQL_ROOT_PASSWORD: root_password
MYSQL_USER: news_user
MYSQL_PASSWORD: news_password
ports:
- "3306:3306"
volumes:
- db_data:/var/lib/mysql
networks:
- app_network
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
timeout: 20s
retries: 10
# Test Database
db_test:
image: mysql:8.0
container_name: news_aggregator_db_test
restart: unless-stopped
environment:
MYSQL_DATABASE: news_aggregator_test
MYSQL_ROOT_PASSWORD: root_password
MYSQL_USER: news_user
MYSQL_PASSWORD: news_password
ports:
- "3307:3306"
volumes:
- db_test_data:/var/lib/mysql
networks:
- app_network
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
timeout: 20s
retries: 10
# Cache & Sessions
redis:
image: redis:7-alpine
container_name: news_aggregator_redis
restart: unless-stopped
ports:
- "6379:6379"
networks:
- app_network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
timeout: 5s
retries: 5
# Laravel Backend
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: news_aggregator_backend
restart: unless-stopped
working_dir: /var/www
volumes:
- ./backend:/var/www
- ./backend/storage:/var/www/storage
networks:
- app_network
depends_on:
db:
condition: service_healthy
db_test:
condition: service_healthy
redis:
condition: service_healthy
environment:
- APP_ENV=local
- APP_DEBUG=true
- DB_HOST=db
- DB_DATABASE=news_aggregator
- DB_USERNAME=news_user
- DB_PASSWORD=news_password
- DB_TEST_HOST=db_test
- DB_TEST_DATABASE=news_aggregator_test
- DB_TEST_USERNAME=news_user
- DB_TEST_PASSWORD=news_password
- REDIS_HOST=redis
- REDIS_PORT=6379
- MAIL_MAILER=smtp
- MAIL_HOST=mailpit
- MAIL_PORT=1025
healthcheck:
test: ["CMD", "php", "artisan", "--version"]
timeout: 10s
retries: 5
# Nginx for Backend API
nginx:
image: nginx:alpine
container_name: news_aggregator_nginx
restart: unless-stopped
ports:
- "8000:80"
volumes:
- ./backend:/var/www
- ./backend/nginx.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
# React Frontend
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: news_aggregator_frontend
restart: unless-stopped
ports:
- "3000:3000"
volumes:
- ./frontend:/app
- /app/node_modules
networks:
- app_network
environment:
- NODE_ENV=development
- VITE_API_BASE_URL=http://nanle.local.api:8000/api
depends_on:
- nginx
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:3000"]
timeout: 10s
retries: 5
# Email Testing
mailpit:
image: axllent/mailpit:latest
container_name: news_aggregator_mailpit
restart: unless-stopped
ports:
- "1025:1025" # SMTP
- "8025:8025" # Web UI
networks:
- app_network
volumes:
db_data:
db_test_data:
networks:
app_network:
driver: bridge