-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
204 lines (193 loc) · 4.87 KB
/
docker-compose.yml
File metadata and controls
204 lines (193 loc) · 4.87 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
version: '3.8'
services:
# Main web application
web:
build:
context: .
dockerfile: Dockerfile
target: production
ports:
- "${PORT:-5000}:5000"
environment:
- SKB_ENVIRONMENT=production
- SKB_DEBUG=false
- SKB_ENABLE_CACHING=true
- SKB_CACHE_BACKEND=redis
- SKB_REDIS_URL=redis://redis:6379/0
- PYTHONUNBUFFERED=1
volumes:
- ./logs:/var/log/skb
depends_on:
- redis
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5000/health"]
interval: 30s
timeout: 10s
retries: 3
networks:
- skb-network
# Development service with hot reloading
web-dev:
build:
context: .
dockerfile: Dockerfile
target: development
ports:
- "${DEV_PORT:-5000}:5000"
- "${DEBUG_PORT:-5678}:5678" # Debug port
environment:
- SKB_ENVIRONMENT=development
- SKB_DEBUG=true
- SKB_LOG_LEVEL=DEBUG
- SKB_ENABLE_CACHING=false
- SKB_ENABLE_FILE_LOGGING=true
- SKB_LOG_FILE_PATH=/app/logs/development.log
- PYTHONUNBUFFERED=1
- PYTHONDONTWRITEBYTECODE=1
- FLASK_APP=src.app:app
volumes:
- .:/app
- ./logs:/app/logs
- /app/.venv
- /app/__pycache__
- /app/.pytest_cache
command: ["python", "-m", "flask", "run", "--host=0.0.0.0", "--port=5000", "--debug"]
depends_on:
- redis-dev
networks:
- skb-network
profiles:
- development
# Redis cache for production
redis:
image: redis:7-alpine
ports:
- "6379:6379"
volumes:
- redis_data:/data
- ./infrastructure/redis/redis.conf:/usr/local/etc/redis/redis.conf
command: redis-server /usr/local/etc/redis/redis.conf
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 3
networks:
- skb-network
# Redis for development (no persistence)
redis-dev:
image: redis:7-alpine
ports:
- "6380:6379"
command: redis-server --save "" --appendonly no --maxmemory 256mb --maxmemory-policy allkeys-lru
networks:
- skb-network
profiles:
- development
# Background task worker (future implementation)
worker:
build:
context: .
dockerfile: Dockerfile
target: production
environment:
- SKB_ENVIRONMENT=production
- SKB_REDIS_URL=redis://redis:6379/0
- PYTHONUNBUFFERED=1
command: ["celery", "-A", "src.tasks.celery_app", "worker", "--loglevel=info"]
depends_on:
- redis
restart: unless-stopped
volumes:
- ./logs:/var/log/skb
networks:
- skb-network
profiles:
- worker
# Nginx reverse proxy for production
nginx:
image: nginx:alpine
ports:
- "80:80"
- "443:443"
volumes:
- ./infrastructure/nginx/nginx.conf:/etc/nginx/nginx.conf
- ./infrastructure/nginx/ssl:/etc/nginx/ssl
- ./static:/var/www/static
depends_on:
- web
restart: unless-stopped
networks:
- skb-network
profiles:
- production
# Monitoring with Prometheus (optional)
prometheus:
image: prom/prometheus:latest
ports:
- "9090:9090"
volumes:
- ./infrastructure/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus_data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/etc/prometheus/console_libraries'
- '--web.console.templates=/etc/prometheus/consoles'
- '--storage.tsdb.retention.time=200h'
- '--web.enable-lifecycle'
restart: unless-stopped
networks:
- skb-network
profiles:
- monitoring
# Grafana for visualization (optional)
grafana:
image: grafana/grafana:latest
ports:
- "3000:3000"
environment:
- GF_SECURITY_ADMIN_PASSWORD=admin
volumes:
- grafana_data:/var/lib/grafana
- ./infrastructure/grafana/dashboards:/etc/grafana/provisioning/dashboards
- ./infrastructure/grafana/datasources:/etc/grafana/provisioning/datasources
depends_on:
- prometheus
restart: unless-stopped
networks:
- skb-network
profiles:
- monitoring
# Testing service
test:
build:
context: .
dockerfile: Dockerfile
target: testing
environment:
- SKB_ENVIRONMENT=testing
- PYTHONUNBUFFERED=1
volumes:
- .:/app
- ./test-results:/app/test-results
command: ["python", "-m", "pytest", "-v", "--cov=src", "--cov-report=html", "--cov-report=xml"]
networks:
- skb-network
profiles:
- testing
volumes:
redis_data:
driver: local
prometheus_data:
driver: local
grafana_data:
driver: local
networks:
skb-network:
driver: bridge
ipam:
config:
- subnet: 172.20.0.0/16