forked from xprilion/OpenMLR
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
124 lines (118 loc) · 3.15 KB
/
docker-compose.yml
File metadata and controls
124 lines (118 loc) · 3.15 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
# OpenMLR - Development Docker Compose
# Docs: https://openmlr.dev/setup
#
# Usage:
# make dev-up # Start with live reload
# make dev-logs # Watch logs
# make dev-down # Stop services
#
# For production, use: docker compose -f docker-compose.prod.yml up -d
services:
# PostgreSQL database
db:
image: postgres:16-alpine
environment:
POSTGRES_USER: ${POSTGRES_USER:-openmlr}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-openmlr}
POSTGRES_DB: ${POSTGRES_DB:-openmlr}
volumes:
- pgdata:/var/lib/postgresql/data
ports:
- "127.0.0.1:5433:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-openmlr}"]
interval: 5s
timeout: 5s
retries: 5
# Redis for Celery broker and pub/sub
redis:
image: redis:7-alpine
ports:
- "127.0.0.1:6380:6379"
volumes:
- redisdata:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 5
# Web with live reload - mounts source code
web:
build:
context: .
dockerfile: Dockerfile.dev
ports:
- "3000:3000"
command: >
uvicorn openmlr.app:app
--host 0.0.0.0 --port 3000
--reload --reload-dir /app/backend/openmlr
working_dir: /app/backend
env_file:
- path: .env
required: false
environment:
DATABASE_URL: postgresql+asyncpg://${POSTGRES_USER:-openmlr}:${POSTGRES_PASSWORD:-openmlr}@db:5432/${POSTGRES_DB:-openmlr}
REDIS_URL: redis://redis:6379/0
USE_BACKGROUND_JOBS: "true"
USE_REDIS_PUBSUB: "true"
PYTHONDONTWRITEBYTECODE: "1"
PYTHONUNBUFFERED: "1"
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
volumes:
- ./backend:/app/backend
- backend-venv:/app/backend/.venv
- ./frontend/dist:/app/frontend/dist
- ./.keys:/app/.keys
# Worker with auto-restart on code changes
worker:
build:
context: .
dockerfile: Dockerfile.dev
command: >
watchmedo auto-restart
--directory=/app/backend/openmlr
--pattern=*.py
--recursive
--
celery -A openmlr.celery_app worker
--loglevel=info
--concurrency=2
-Q default,agent
working_dir: /app/backend
env_file:
- path: .env
required: false
environment:
DATABASE_URL: postgresql+asyncpg://${POSTGRES_USER:-openmlr}:${POSTGRES_PASSWORD:-openmlr}@db:5432/${POSTGRES_DB:-openmlr}
REDIS_URL: redis://redis:6379/0
PYTHONDONTWRITEBYTECODE: "1"
PYTHONUNBUFFERED: "1"
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
volumes:
- ./backend:/app/backend
- backend-venv:/app/backend/.venv
- ./.keys:/app/.keys
# Docs site with live reload
docs:
image: node:20-slim
working_dir: /app/site
command: sh -c "npm install && npx vitepress dev docs --host 0.0.0.0 --port 4000"
ports:
- "127.0.0.1:4000:4000"
volumes:
- ./site:/app/site
- docs-node-modules:/app/site/node_modules
volumes:
pgdata:
redisdata:
backend-venv:
docs-node-modules: