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

51 lines
1.5 KiB
YAML

services:
ml:
build:
context: ../..
dockerfile: ml/Dockerfile
environment:
# giga loads the pinned model baked into the image; fake is the hash
# encoder for stands without the model; none keeps the service not ready.
ML_EMBEDDER: ${ML_EMBEDDER:-giga}
ML_TORCH_THREADS: ${ML_TORCH_THREADS:-4}
ML_MICRO_BATCH: ${ML_MICRO_BATCH:-1}
ML_VERIFY_WEIGHTS: ${ML_VERIFY_WEIGHTS:-true}
# 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 model takes about 3.6 GiB resident with four torch threads
# (research CPU benchmark); the limits leave headroom for a request batch.
deploy:
resources:
limits:
cpus: "4.0"
memory: 5G
networks:
# The core project network; start the core project first (make -C deploy up).
app:
name: ${APP_NETWORK:-app_default}
external: true