-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
74 lines (69 loc) · 2.55 KB
/
Copy pathdocker-compose.yml
File metadata and controls
74 lines (69 loc) · 2.55 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
version: "3.9"
services:
# ── PostgreSQL Database ──────────────────────────────────────────────────────
db:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_DB: quantyield
POSTGRES_USER: quantyield
POSTGRES_PASSWORD: quantyield_dev
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U quantyield"]
interval: 10s
timeout: 5s
retries: 5
# ── Redis Cache ───────────────────────────────────────────────────────────────
redis:
image: redis:7-alpine
restart: unless-stopped
command: redis-server --maxmemory 256mb --maxmemory-policy allkeys-lru
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
# ── Django API ────────────────────────────────────────────────────────────────
api:
build: .
restart: unless-stopped
ports:
- "8000:8000"
environment:
DJANGO_SETTINGS_MODULE: quantyield.settings.production
SECRET_KEY: ${SECRET_KEY:-django-insecure-docker-dev-key-change-me}
DEBUG: "False"
DATABASE_URL: postgres://quantyield:quantyield_dev@db:5432/quantyield
CACHE_URL: redis://redis:6379/1
CORS_ALLOWED_ORIGINS: ${CORS_ALLOWED_ORIGINS:-http://localhost:3000}
FRED_API_KEY: ${FRED_API_KEY:-}
CURVE_CACHE_TTL: "300"
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
volumes:
- static_files:/app/staticfiles
command: >
sh -c "
python manage.py migrate --noinput &&
python manage.py seed_data &&
uvicorn quantyield.asgi:application --host 0.0.0.0 --port 8000 --workers 4
"
# ── Nginx Reverse Proxy ───────────────────────────────────────────────────────
nginx:
image: nginx:1.25-alpine
restart: unless-stopped
ports:
- "80:80"
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
- static_files:/staticfiles:ro
depends_on:
- api
volumes:
postgres_data:
static_files: