-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
91 lines (83 loc) · 2.18 KB
/
docker-compose.yaml
File metadata and controls
91 lines (83 loc) · 2.18 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
services:
# 1. Database Service (PostgreSQL)
db:
image: postgres:15-alpine
volumes:
- postgres_data:/var/lib/postgresql/data
environment:
- POSTGRES_DB=${DB_NAME}
- POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_PASSWORD}
ports:
- "5432:5432" # Exposed for local development
networks:
- main_network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_NAME}"]
interval: 5s
timeout: 5s
retries: 5
# 2. Redis Service (Cache & WebSockets Layer)
redis:
image: redis:7-alpine
ports:
- "6379:6379" # Exposed so you can inspect it locally if needed
networks:
- main_network
# 3. pgAdmin (Database UI)
pgadmin:
image: dpage/pgadmin4:latest
environment:
- PGADMIN_DEFAULT_EMAIL=${PGADMIN_EMAIL:-admin@admin.com}
- PGADMIN_DEFAULT_PASSWORD=${PGADMIN_PASSWORD:-admin}
- PGADMIN_CONFIG_SERVER_MODE=False
- PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED=False
ports:
- "5050:80"
volumes:
- pgadmin_data:/var/lib/pgadmin
depends_on:
- db
networks:
- main_network
# 4. Backend Service (Django)
backend:
build: ./backend
command: daphne -b 0.0.0.0 -p 8000 config.asgi:application
volumes:
- ./backend:/app # Hot-reloading: changes in local folder reflect in container
ports:
- "8000:8000"
env_file:
- .env
environment:
- DB_HOST=db
- REDIS_HOST=redis
depends_on:
db:
condition: service_healthy
redis:
condition: service_started
networks:
- main_network
# 5. Frontend Service (React + Vite)
frontend:
build: ./frontend
volumes:
- ./frontend:/app
- /app/node_modules # Prevents local node_modules from overwriting container's
ports:
- "5173:5173"
environment:
- VITE_API_URL=http://localhost:8000
- VITE_WS_URL=ws://localhost:8000
depends_on:
- backend
networks:
- main_network
volumes:
postgres_data: # Persist DB data even if containers are destroyed
pgadmin_data: # Persist pgAdmin settings and server configurations
networks:
main_network:
driver: bridge