-
Notifications
You must be signed in to change notification settings - Fork 169
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
193 lines (186 loc) · 5.55 KB
/
Copy pathdocker-compose.yml
File metadata and controls
193 lines (186 loc) · 5.55 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# DataInfra-RedactionEverything docker compose
#
# CPU API/frontend only:
# docker compose up -d
#
# Full GPU model stack:
# docker compose --profile gpu up -d
services:
backend:
build:
context: ./backend
dockerfile: Dockerfile
ports:
- "${BACKEND_PORT:-8000}:8000"
env_file:
- path: ${BACKEND_ENV_FILE:-.env}
required: false
environment:
- DEBUG=${DEBUG:-false}
- DATA_DIR=/app/data
- UPLOAD_DIR=/app/uploads
- OUTPUT_DIR=/app/outputs
- AUTH_ENABLED=${AUTH_ENABLED:-true}
- JWT_SECRET_KEY=${JWT_SECRET_KEY:-}
- VIRUS_SCAN_ENABLED=${VIRUS_SCAN_ENABLED:-false}
- OCR_REQUIRE_GPU=${OCR_REQUIRE_GPU:-false}
- JOB_CONCURRENCY=${JOB_CONCURRENCY:-3}
- BATCH_RECOGNITION_PAGE_CONCURRENCY=${BATCH_RECOGNITION_PAGE_CONCURRENCY:-1}
- HAS_NER_MAX_PARALLEL_REQUESTS=${HAS_NER_MAX_PARALLEL_REQUESTS:-1}
- VISUAL_FEATURES_CONCURRENCY=${VISUAL_FEATURES_CONCURRENCY:-1}
- VISION_DUAL_PIPELINE_PARALLEL=${VISION_DUAL_PIPELINE_PARALLEL:-false}
- OCR_BASE_URL=http://ocr:8082
- HAS_TEXT_RUNTIME=${HAS_TEXT_RUNTIME:-vllm}
- HAS_TEXT_VLLM_BASE_URL=http://ner:8080/v1
- HAS_TEXT_MODEL_NAME=${HAS_TEXT_MODEL_NAME:-HaS_Text_0209_0.6B}
- VISUAL_FEATURES_BASE_URL=http://visual-features:8090
- CORS_ORIGINS=${CORS_ORIGINS:-["http://localhost:${FRONTEND_PORT:-3000}","http://127.0.0.1:${FRONTEND_PORT:-3000}"]}
volumes:
- backend-data:/app/data
- backend-uploads:/app/uploads
- backend-outputs:/app/outputs
networks:
- redaction-net
healthcheck:
test: ["CMD", "python", "-c", "import httpx; httpx.get('http://localhost:8000/health').raise_for_status()"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
restart: unless-stopped
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
ports:
- "${FRONTEND_PORT:-3000}:8080"
depends_on:
backend:
condition: service_healthy
networks:
- redaction-net
healthcheck:
test: ["CMD-SHELL", "wget -qO /dev/null http://localhost:8080/ || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
restart: unless-stopped
ocr:
build:
context: ./backend
dockerfile: Dockerfile.ocr
ports:
- "${OCR_PORT:-8082}:8082"
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
networks:
- redaction-net
healthcheck:
test: ["CMD", "python", "-c", "import httpx; httpx.get('http://localhost:8082/health').raise_for_status()"]
interval: 30s
timeout: 15s
retries: 5
start_period: 60s
profiles:
- gpu
restart: unless-stopped
ner:
# Same runtime and weights as local development (vLLM + HF bf16), so the
# NER behavior validated locally carries over to Docker unchanged.
image: vllm/vllm-openai:v0.19.1
ipc: host
ports:
- "${NER_PORT:-8080}:8080"
volumes:
- ./backend/models:/models
command:
- --model
- /models/has/HaS_Text_0209_0.6B
- --served-model-name
- HaS_Text_0209_0.6B
- --host
- 0.0.0.0
- --port
- "8080"
- --trust-remote-code
- --dtype
- bfloat16
- --max-model-len
- "4096"
- --max-num-batched-tokens
- "4096"
- --gpu-memory-utilization
- "0.18"
- --kv-cache-memory-bytes
- "671088640"
- --no-enable-prefix-caching
- --enforce-eager
- --default-chat-template-kwargs
- '{"enable_thinking":false}'
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
networks:
- redaction-net
healthcheck:
test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8080/health')"]
interval: 30s
timeout: 10s
retries: 5
start_period: 120s
profiles:
- gpu
restart: unless-stopped
visual-features:
build:
context: ./backend
dockerfile: Dockerfile.locateanything
ports:
- "${VISUAL_FEATURES_PORT:-8090}:8090"
environment:
- LOCATE_ANYTHING_MODEL=${LOCATE_ANYTHING_MODEL:-/models/locateanything/LocateAnything-3B-HF}
- LOCATE_ANYTHING_BACKEND=${LOCATE_ANYTHING_BACKEND:-hf}
- LOCATE_ANYTHING_DTYPE=${LOCATE_ANYTHING_DTYPE:-bfloat16}
- LOCATE_ANYTHING_PORT=8090
- LOCATE_ANYTHING_MAX_IMAGE_SIDE=${LOCATE_ANYTHING_MAX_IMAGE_SIDE:-1280}
- LOCATE_ANYTHING_SIGNATURE_MAX_IMAGE_SIDE=${LOCATE_ANYTHING_SIGNATURE_MAX_IMAGE_SIDE:-1280}
- LOCATE_ANYTHING_SIGNATURE_TILE_MAX_IMAGE_SIDE=${LOCATE_ANYTHING_SIGNATURE_TILE_MAX_IMAGE_SIDE:-1280}
- LOCATE_ANYTHING_MAX_NEW_TOKENS=${LOCATE_ANYTHING_MAX_NEW_TOKENS:-8192}
- LOCATE_ANYTHING_GENERATION_MODE=${LOCATE_ANYTHING_GENERATION_MODE:-hybrid}
volumes:
- ./backend/models:/models
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
networks:
- redaction-net
healthcheck:
test: ["CMD", "python", "-c", "import httpx; httpx.get('http://localhost:8090/health').raise_for_status()"]
interval: 30s
timeout: 15s
retries: 5
start_period: 120s
profiles:
- gpu
restart: unless-stopped
volumes:
backend-data:
backend-uploads:
backend-outputs:
networks:
redaction-net:
driver: bridge