-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
90 lines (85 loc) · 2.41 KB
/
docker-compose.dev.yml
File metadata and controls
90 lines (85 loc) · 2.41 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
services:
db:
image: postgres:15-alpine
environment:
POSTGRES_DB: memory_tracker
POSTGRES_USER: memory_tracker_user
POSTGRES_PASSWORD: memory_tracker_password
volumes:
- postgres_data_dev:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U memory_tracker_user -d memory_tracker"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
backend:
build:
context: ./backend
dockerfile: Dockerfile.dev
env_file:
- .env
environment:
DATABASE_URL: postgresql+asyncpg://memory_tracker_user:memory_tracker_password@db:5432/memory_tracker
CORS_ORIGINS: http://localhost:9002,http://frontend:9002
ports:
- "8000:8000"
depends_on:
db:
condition: service_healthy
volumes:
# Mount the entire backend directory for hot reloading
- ./backend:/app:rw
# Prevent node_modules/venv from being overwritten
- /app/__pycache__
command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
restart: unless-stopped
frontend:
image: node:20-alpine
working_dir: /app
environment:
NEXT_PUBLIC_API_BASE: http://localhost:8000/api
ports:
- "9002:9002"
depends_on:
- backend
volumes:
# Mount the entire frontend directory
- ./frontend:/app:rw
# Prevent node_modules from being overwritten
- /app/node_modules
- /app/.next
command: sh -c "npm install && npm run dev"
restart: unless-stopped
# Database initialization service
db-init:
build:
context: ./backend
dockerfile: Dockerfile.dev
env_file:
- .env
environment:
DATABASE_URL: postgresql+asyncpg://memory_tracker_user:memory_tracker_password@db:5432/memory_tracker
depends_on:
backend:
condition: service_started
volumes:
- ./backend:/app:ro
command: >
sh -c "
echo 'Waiting for backend to be ready...' &&
sleep 10 &&
echo 'Checking for asyncpg...' &&
python -c 'import asyncpg; print(\"asyncpg version:\", asyncpg.__version__)' &&
echo 'Populating database with default binaries...' &&
python scripts/populate_binaries.py &&
echo 'Database initialization complete!'
"
restart: "no"
volumes:
postgres_data_dev:
networks:
default:
name: memory_tracker_dev_network