-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
84 lines (81 loc) · 2.28 KB
/
Copy pathdocker-compose.yml
File metadata and controls
84 lines (81 loc) · 2.28 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
services:
# FastAPI service for anonymization
api:
build: .
container_name: pii-anonymizer-api
ports:
- "8000:8000"
environment:
- TEMPLATES_DIR=/app/templates
- CUSTOM_TEMPLATES_DIR=/app/data/templates
- PSEUDONYM_SECRET=${PSEUDONYM_SECRET:-your-secret-key-change-me}
- DEFAULT_TEMPLATE_ID=default-pii-v1
- OLLAMA_BASE_URL=http://ollama:11434
- OLLAMA_FALLBACK_URLS=http://host.docker.internal:11434
- LLM_MODEL=llama3.1:8b-instruct-q4_K_M
- LLM_CONCURRENCY=2
- LLM_NUM_PREDICT=512
- LLM_TEMPERATURE=0
- OLLAMA_KEEP_ALIVE=30m
- CHUNKING_ENABLED=true
- CHUNK_CHAR_TARGET=8000
- CHUNK_OVERLAP_CHARS=200
- CHUNK_MAX_PARALLEL=2
- RULE_PREEXTRACT_ENABLED=true
- LOG_SENSITIVE=false
- TOKEN_ID_LEN=6
volumes:
- ./templates:/app/templates:ro
- ./data/templates:/app/data/templates
extra_hosts:
- "host.docker.internal:host-gateway"
depends_on:
ollama:
condition: service_healthy
networks:
- anonymizer
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 10s
timeout: 3s
retries: 5
start_period: 30s
# Ollama service for LLM inference
ollama:
image: ollama/ollama:latest
container_name: pii-anonymizer-ollama
ports:
- "11434:11434"
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
environment:
- OLLAMA_NUM_GPU=1
- OLLAMA_MAX_LOADED_MODELS=1
- OLLAMA_NUM_PARALLEL=2
- NVIDIA_VISIBLE_DEVICES=all
- NVIDIA_DRIVER_CAPABILITIES=compute,utility
volumes:
- ollama_models:/root/.ollama
networks:
- anonymizer
healthcheck:
test: ["CMD", "ollama", "list"]
interval: 10s
timeout: 3s
retries: 5
start_period: 30s
# Optional: pre-pull manually once:
# docker exec pii-anonymizer-ollama ollama pull llama3.1:8b-instruct-q4_K_M
# docker exec pii-anonymizer-ollama ollama pull qwen2.5:7b-instruct-q4_K_M
# docker exec pii-anonymizer-ollama ollama pull qwen2.5:14b-instruct-q4_K_M
networks:
anonymizer:
driver: bridge
volumes:
ollama_models:
driver: local