-
Notifications
You must be signed in to change notification settings - Fork 72
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
179 lines (170 loc) · 5.44 KB
/
docker-compose.dev.yml
File metadata and controls
179 lines (170 loc) · 5.44 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
version: "3.8"
# Development environment — standalone file with hot reload and dev tools.
# Usage: docker compose -f docker-compose.dev.yml up
# Or: make dev
networks:
bridge-watch:
driver: bridge
services:
# ---------------------------------------------------------------------------
# PostgreSQL + TimescaleDB
# ---------------------------------------------------------------------------
postgres:
image: timescale/timescaledb:latest-pg15
container_name: bridge-watch-postgres
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB:-bridge_watch}
POSTGRES_USER: ${POSTGRES_USER:-bridge_watch}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-bridge_watch_dev}
ports:
- "${POSTGRES_PORT:-5432}:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./scripts/init-db.sql:/docker-entrypoint-initdb.d/01-init.sql:ro
healthcheck:
test:
[
"CMD-SHELL",
"pg_isready -U ${POSTGRES_USER:-bridge_watch} -d ${POSTGRES_DB:-bridge_watch}",
]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
networks:
- bridge-watch
# ---------------------------------------------------------------------------
# Redis
# ---------------------------------------------------------------------------
redis:
image: redis:7-alpine
container_name: bridge-watch-redis
restart: unless-stopped
ports:
- "${REDIS_PORT:-6379}:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
networks:
- bridge-watch
# ---------------------------------------------------------------------------
# Backend — dev stage with tsx watch hot reload
# ---------------------------------------------------------------------------
backend:
build:
context: ./backend
dockerfile: Dockerfile
target: dev
container_name: bridge-watch-backend
restart: unless-stopped
environment:
NODE_ENV: development
PORT: 3001
WS_PORT: 3002
POSTGRES_HOST: postgres
POSTGRES_PORT: 5432
POSTGRES_DB: ${POSTGRES_DB:-bridge_watch}
POSTGRES_USER: ${POSTGRES_USER:-bridge_watch}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-bridge_watch_dev}
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_PASSWORD: ${REDIS_PASSWORD:-}
LOG_LEVEL: ${LOG_LEVEL:-debug}
ports:
- "${PORT:-3001}:3001"
- "${WS_PORT:-3002}:3002"
volumes:
# Mount the entire backend directory for hot reload
- ./backend:/app
# Isolated node_modules inside the container
- backend_node_modules:/app/node_modules
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test:
["CMD-SHELL", "wget -qO- http://localhost:3001/health || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
networks:
- bridge-watch
# ---------------------------------------------------------------------------
# Frontend — dev stage with Vite hot module replacement
# ---------------------------------------------------------------------------
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
target: dev
container_name: bridge-watch-frontend
restart: unless-stopped
environment:
VITE_API_URL: http://localhost:${PORT:-3001}
VITE_WS_URL: ws://localhost:${WS_PORT:-3002}
ports:
- "${FRONTEND_PORT:-5173}:5173"
volumes:
# Mount the entire frontend directory for hot reload
- ./frontend:/app
# Isolated node_modules inside the container
- frontend_node_modules:/app/node_modules
depends_on:
- backend
networks:
- bridge-watch
# ---------------------------------------------------------------------------
# PgAdmin 4 — always on in dev (no profile required)
# ---------------------------------------------------------------------------
pgadmin:
image: dpage/pgadmin4:latest
container_name: bridge-watch-pgadmin
restart: unless-stopped
environment:
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_EMAIL:-admin@bridgewatch.dev}
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_PASSWORD:-admin}
PGADMIN_CONFIG_SERVER_MODE: "False"
PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: "False"
ports:
- "${PGADMIN_PORT:-5050}:80"
volumes:
- pgadmin_data:/var/lib/pgadmin
- ./scripts/pgadmin-servers.json:/pgadmin4/servers.json:ro
depends_on:
postgres:
condition: service_healthy
networks:
- bridge-watch
# ---------------------------------------------------------------------------
# Redis Commander — always on in dev (no profile required)
# ---------------------------------------------------------------------------
redis-commander:
image: rediscommander/redis-commander:latest
container_name: bridge-watch-redis-commander
restart: unless-stopped
environment:
REDIS_HOSTS: "local:redis:6379:0:${REDIS_PASSWORD:-}"
HTTP_USER: ${REDIS_COMMANDER_USER:-admin}
HTTP_PASSWORD: ${REDIS_COMMANDER_PASSWORD:-admin}
ports:
- "${REDIS_COMMANDER_PORT:-8081}:8081"
depends_on:
redis:
condition: service_healthy
networks:
- bridge-watch
volumes:
postgres_data:
redis_data:
pgadmin_data:
backend_node_modules:
frontend_node_modules: