#!/bin/sh
# Run a script from this folder inside the milvus image.
# DATA_DIR (host) holds chunks.jsonl and the Lite database directory kb.db; it is mounted at /data.
# Usage: ./run.sh load.py [args]
: "${DATA_DIR:?set DATA_DIR to a host folder with chunks.jsonl}"
exec docker run --rm \
  --user "$(id -u):$(id -g)" -e HOME=/tmp \
  --add-host host.docker.internal:host-gateway \
  -v "$DATA_DIR":/data \
  -v "$(cd "$(dirname "$0")" && pwd)":/work:ro \
  ${EXTRA_DOCKER_ARGS:-} \
  -e CHUNKS_PATH=/data/chunks.jsonl -e KB_URI="${KB_URI:-/data/kb.db}" \
  -e OLLAMA_URL="http://host.docker.internal:11434" \
  kb-milvus:3.0.2 python "$@"
