-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
88 lines (84 loc) · 2.2 KB
/
Copy pathdocker-compose.yml
File metadata and controls
88 lines (84 loc) · 2.2 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
services:
postgres:
image: postgres:13
container_name: trivia-postgres
environment:
POSTGRES_USER: trivia_user
POSTGRES_PASSWORD: trivia_pass
POSTGRES_DB: trivia_db
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U trivia_user -d trivia_db"]
interval: 10s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
container_name: trivia-redis
ports:
- "6379:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
backend:
build:
context: ./backend
dockerfile: Dockerfile.dev
container_name: trivia-backend
command: /app/docker-entrypoint.sh
volumes:
- ./backend:/app
- backend_venv:/root/.cache/pip # Cache pip packages
ports:
- "8000:8000"
environment:
- DATABASE_URL=postgresql://trivia_user:trivia_pass@postgres:5432/trivia_db
- REDIS_URL=redis://redis:6379/0
- SECRET_KEY=${SECRET_KEY:-dev-secret-key-change-in-production-use-openssl-rand-hex-32}
- DEBUG=True
- CORS_ORIGINS=["http://localhost:5173","http://localhost:3000"]
- APP_NAME=trivia-app
- API_V1_PREFIX=/api/v1
- ALGORITHM=HS256
- ACCESS_TOKEN_EXPIRE_MINUTES=15
- REFRESH_TOKEN_EXPIRE_DAYS=7
- BCRYPT_SALT_ROUNDS=12
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
restart: unless-stopped
frontend:
build:
context: ./frontend
dockerfile: Dockerfile.dev
container_name: trivia-frontend
command: npm run dev -- --host 0.0.0.0
volumes:
- ./frontend:/app
- /app/node_modules # Prevent overwriting node_modules from host
ports:
- "5173:5173"
environment:
- VITE_API_URL=http://localhost:8000
depends_on:
- backend
restart: unless-stopped
volumes:
postgres_data:
redis_data:
backend_venv: