Files
lincodex/deploy/docker/docker-compose.ml.yml

57 lines
1.8 KiB
YAML

services:
ml:
build:
context: ../..
dockerfile: ml/Dockerfile
environment:
# A comma list of the pinned models baked into the image (giga, qwen3),
# the first one is the default; fake is the hash encoder for stands
# without the models; none keeps the service not ready. The ensemble
# policy needs giga,qwen3.
ML_EMBEDDER: ${ML_EMBEDDER:-giga,qwen3}
ML_TORCH_THREADS: ${ML_TORCH_THREADS:-4}
ML_MICRO_BATCH: ${ML_MICRO_BATCH:-1}
ML_VERIFY_WEIGHTS: ${ML_VERIFY_WEIGHTS:-true}
# The container listens on all its interfaces, so the service refuses
# to start without the shared bearer token that the backend sends.
ML_SERVICE_TOKEN: ${ML_SERVICE_TOKEN:-}
# Loopback only: the backend reaches the service over the app network by
# the alias below, never through a published port.
ports:
- "${ML_BIND_ADDRESS:-127.0.0.1}:${ML_HTTP_PORT:-8000}:8000"
networks:
default:
app:
aliases:
- ml
healthcheck:
test:
- CMD
- python
- -c
- "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/healthz', timeout=2)"
interval: 10s
timeout: 3s
retries: 5
start_period: 15s
restart: unless-stopped
logging:
driver: json-file
options:
max-size: 10m
max-file: "3"
# The float32 Giga model takes about 3.6 GiB resident with four torch
# threads (research CPU benchmark) and Qwen3-Embedding about 2.5 GiB more;
# the limits leave headroom for a request batch.
deploy:
resources:
limits:
cpus: "4.0"
memory: 8G
networks:
# The core project network; start the core project first (make -C deploy up).
app:
name: ${APP_NETWORK:-app_default}
external: true