-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
176 lines (167 loc) · 5.6 KB
/
Copy pathdocker-compose.yml
File metadata and controls
176 lines (167 loc) · 5.6 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
# =============================================================================
# HireLens — Docker Compose (lives at project root alongside .env)
# Services: FastAPI backend, React frontend, PostgreSQL, MLflow
# =============================================================================
x-logging: &default-logging
driver: json-file
options:
max-size: "50m"
max-file: "5"
networks:
hirelens-net:
driver: bridge
volumes:
postgres_data:
mlflow_data:
upload_data:
model_cache:
redis_data:
services:
# ── Redis (embedding cache) ─────────────────────────────────────────────────
redis:
image: redis:7.2-alpine
container_name: hirelens-redis
restart: unless-stopped
command: redis-server --maxmemory 256mb --maxmemory-policy allkeys-lru --save ""
volumes:
- redis_data:/data
ports:
- "${REDIS_PORT:-6379}:6379"
networks:
- hirelens-net
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 5
start_period: 5s
logging: *default-logging
# ── PostgreSQL ──────────────────────────────────────────────────────────────
postgres:
image: postgres:16.3-alpine
container_name: hirelens-postgres
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB:-hirelens}
POSTGRES_USER: ${POSTGRES_USER:-hirelens_user}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required}
PGDATA: /var/lib/postgresql/data/pgdata
volumes:
- postgres_data:/var/lib/postgresql/data
- ./docker/postgres/init.sql:/docker-entrypoint-initdb.d/init.sql:ro
ports:
- "${POSTGRES_PORT:-5432}:5432"
networks:
- hirelens-net
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-hirelens_user} -d ${POSTGRES_DB:-hirelens}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
logging: *default-logging
# ── MLflow Tracking Server ──────────────────────────────────────────────────
mlflow:
build:
context: .
dockerfile: docker/Dockerfile.mlflow
container_name: hirelens-mlflow
restart: unless-stopped
command:
- "--host=0.0.0.0"
- "--port=5000"
- "--backend-store-uri=postgresql://${POSTGRES_USER:-hirelens_user}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-hirelens}_mlflow"
- "--default-artifact-root=${MLFLOW_ARTIFACT_ROOT:-/mlflow/artifacts}"
- "--serve-artifacts"
environment:
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID:-}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY:-}
AWS_DEFAULT_REGION: ${AWS_DEFAULT_REGION:-us-east-1}
MLFLOW_S3_ENDPOINT_URL: ${MLFLOW_S3_ENDPOINT_URL:-}
volumes:
- mlflow_data:/mlflow/artifacts
ports:
- "${MLFLOW_PORT:-5000}:5000"
networks:
- hirelens-net
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-sf", "http://0.0.0.0:5000/health"]
interval: 15s
timeout: 5s
retries: 5
start_period: 20s
logging: *default-logging
# ── FastAPI Backend ─────────────────────────────────────────────────────────
backend:
build:
context: .
dockerfile: docker/Dockerfile.backend
args:
PYTHON_VERSION: "3.12.3"
container_name: hirelens-backend
restart: unless-stopped
env_file:
- .env
environment:
DATABASE_URL: postgresql+asyncpg://${POSTGRES_USER:-hirelens_user}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-hirelens}
MLFLOW_TRACKING_URI: http://mlflow:5000
MODEL_CACHE_DIR: /app/models/cache
REDIS_URL: redis://redis:6379/0
volumes:
- upload_data:/app/uploads
- model_cache:/app/models/cache
- ./logs:/app/logs
ports:
- "${API_PORT:-8000}:8000"
networks:
- hirelens-net
depends_on:
postgres:
condition: service_healthy
mlflow:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 20s
timeout: 10s
retries: 5
start_period: 40s
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
logging: *default-logging
# ── React Frontend ──────────────────────────────────────────────────────────
frontend:
build:
context: .
dockerfile: docker/Dockerfile.frontend
args:
VITE_API_URL: http://localhost:8000
container_name: hirelens-frontend
restart: unless-stopped
environment:
VITE_API_BASE_URL: ${VITE_API_BASE_URL:-http://localhost:8000}
VITE_APP_ENV: ${APP_ENV:-development}
ports:
- "${FRONTEND_PORT:-3000}:3000"
networks:
- hirelens-net
depends_on:
backend:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000"]
interval: 20s
timeout: 10s
retries: 3
start_period: 20s
logging: *default-logging