-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
116 lines (105 loc) · 3.3 KB
/
docker-compose.dev.yml
File metadata and controls
116 lines (105 loc) · 3.3 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
version: '3.8'
services:
# Ollama service for AI OCR (optional, improves accuracy)
ollama:
image: ollama/ollama:latest
container_name: ttb-ollama
ports:
- "11435:11434"
volumes:
- ollama_models:/root/.ollama
# Note: GPU support disabled for compatibility
# To enable GPU, uncomment the deploy section below
# deploy:
# resources:
# reservations:
# devices:
# - driver: nvidia
# count: all
# capabilities: [gpu]
healthcheck:
test: ["CMD", "ollama", "list"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
restart: unless-stopped
networks:
- ttb-network
# Main TTB Label Verifier API
verifier:
build:
context: .
target: production
container_name: ttb-verifier
ports:
- "8000:8000"
environment:
# Ollama configuration
- OLLAMA_HOST=${OLLAMA_HOST:-http://ollama:11434}
# Model name - change to use custom models from S3 or Ollama registry
# Custom models should be uploaded to s3://{bucket}/models/{MODEL_NAME}.tar.gz
- OLLAMA_MODEL=${OLLAMA_MODEL:-llama3.2-vision}
# App configuration
- LOG_LEVEL=${LOG_LEVEL:-INFO}
- MAX_FILE_SIZE_MB=${MAX_FILE_SIZE_MB:-10}
- MAX_BATCH_SIZE=${MAX_BATCH_SIZE:-50}
# UI configuration - set your domain for host checking
# For local development, set to localhost or use .env file
- DOMAIN_NAME=${DOMAIN_NAME:-localhost}
# Alternatively, set allowed hosts directly:
# - ALLOWED_HOSTS=${ALLOWED_HOSTS:-["localhost", "127.0.0.1"]}
# AWS configuration
- AWS_REGION=${AWS_REGION:-us-east-1}
# Temp directory for file uploads (avoid tmpfs space issues)
- TMPDIR=/app/tmp
# CORS (allow all for prototype)
- CORS_ORIGINS=${CORS_ORIGINS:-["*"]}
# Queue configuration (shared with worker via volume)
- QUEUE_DB_PATH=/app/tmp/queue.db
- QUEUE_MAX_ATTEMPTS=${QUEUE_MAX_ATTEMPTS:-3}
volumes:
# Shared volume: API writes images + queue.db; worker reads them
- ttb-tmp:/app/tmp
depends_on:
- ollama
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 3s
retries: 3
start_period: 10s
restart: unless-stopped
networks:
- ttb-network
# Queue worker — processes one Ollama inference at a time
worker:
build:
context: .
target: worker
container_name: ttb-worker
environment:
- OLLAMA_HOST=${OLLAMA_HOST:-http://ollama:11434}
- OLLAMA_MODEL=${OLLAMA_MODEL:-llama3.2-vision}
# Short per-attempt timeout: retried up to QUEUE_MAX_ATTEMPTS times
- OLLAMA_TIMEOUT_SECONDS=${WORKER_OLLAMA_TIMEOUT_SECONDS:-12}
- WORKER_POLL_INTERVAL=${WORKER_POLL_INTERVAL:-2}
- QUEUE_DB_PATH=/app/tmp/queue.db
- LOG_LEVEL=${LOG_LEVEL:-INFO}
volumes:
# Same shared volume as verifier so worker can read uploaded images
- ttb-tmp:/app/tmp
depends_on:
- ollama
restart: unless-stopped
networks:
- ttb-network
volumes:
ollama_models:
driver: local
# Named volume shared between verifier and worker containers
ttb-tmp:
driver: local
networks:
ttb-network:
driver: bridge