-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
131 lines (123 loc) · 3.42 KB
/
docker-compose.yml
File metadata and controls
131 lines (123 loc) · 3.42 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
version: '3.8'
services:
# PostgreSQL Database
postgres:
image: postgres:15-alpine
container_name: tb-postgres
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-password}
POSTGRES_DB: ${POSTGRES_DB:-time_booking}
ports:
- "${POSTGRES_PORT:-5432}:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"]
interval: 10s
timeout: 5s
retries: 5
networks:
- tb-network
# Redis for Caching and WebSocket pub/sub
redis:
image: redis:7-alpine
container_name: tb-redis
command: redis-server --appendonly yes --requirepass ${REDIS_PASSWORD:-redispassword}
ports:
- "${REDIS_PORT:-6379}:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "--raw", "incr", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- tb-network
# Backend API Server
backend:
build:
context: ./backend
dockerfile: Dockerfile.dev
container_name: tb-backend
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
environment:
- NODE_ENV=development
- PORT=4000
- DATABASE_URL=postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-password}@postgres:5432/${POSTGRES_DB:-time_booking}?schema=public
- REDIS_URL=redis://:${REDIS_PASSWORD:-redispassword}@redis:6379
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_PASSWORD=${REDIS_PASSWORD:-redispassword}
- REFRESH_TOKEN_SECRET=${REFRESH_TOKEN_SECRET}
- JWT_SECRET=${JWT_SECRET:-dev_jwt_secret_key}
- JWT_ACCESS_EXPIRATION=15m
- JWT_REFRESH_EXPIRATION=7d
- CORS_ORIGIN=http://localhost:3000
- LOG_LEVEL=debug
ports:
- "${BACKEND_PORT:-4000}:4000"
volumes:
- ./backend:/app
- /app/node_modules
networks:
- tb-network
command: npm run dev
# Frontend Development Server
frontend:
build:
context: ./frontend
dockerfile: Dockerfile.dev
container_name: tb-frontend
depends_on:
- backend
environment:
- VITE_API_URL=http://localhost:${BACKEND_PORT:-4000}/api
- VITE_WS_URL=ws://localhost:${BACKEND_PORT:-4000}
ports:
- "${FRONTEND_PORT:-3000}:3000"
volumes:
- ./frontend:/app
- /app/node_modules
networks:
- tb-network
command: npm run dev
# Prisma Studio (Database Management UI)
prisma-studio:
build:
context: ./backend
dockerfile: Dockerfile.dev
container_name: tb-prisma-studio
depends_on:
postgres:
condition: service_healthy
environment:
- DATABASE_URL=postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-password}@postgres:5432/${POSTGRES_DB:-time_booking}?schema=public
ports:
- "${PRISMA_STUDIO_PORT:-5555}:5555"
volumes:
- ./backend:/app
- /app/node_modules
networks:
- tb-network
command: npx prisma studio --hostname 0.0.0.0
# MailHog for Email Testing
mailhog:
image: mailhog/mailhog:latest
container_name: tb-mailhog
ports:
- "${MAILHOG_SMTP_PORT:-1025}:1025" # SMTP port
- "${MAILHOG_UI_PORT:-8025}:8025" # Web UI port
networks:
- tb-network
networks:
tb-network:
driver: bridge
volumes:
postgres_data:
redis_data: