#!/bin/sh
# Run a script from this folder against Zilliz Cloud. Same image, same scripts.
# ZILLIZ_ENV_FILE is a mode-600 file with two lines, ZILLIZ_URI=... and ZILLIZ_TOKEN=...
# It goes into the container with --env-file, so the values never appear in a command line or in shell history.
# Usage: ./zilliz_run.sh load.py
: "${DATA_DIR:?set DATA_DIR to a host folder with chunks.jsonl}"
: "${ZILLIZ_ENV_FILE:?set ZILLIZ_ENV_FILE to the env file}"
exec docker run --rm \
  --user "$(id -u):$(id -g)" -e HOME=/tmp \
  --add-host host.docker.internal:host-gateway \
  --env-file "$ZILLIZ_ENV_FILE" \
  -v "$DATA_DIR":/data \
  -v "$(cd "$(dirname "$0")" && pwd)":/work:ro \
  -e CHUNKS_PATH=/data/chunks.jsonl \
  -e OLLAMA_URL="http://host.docker.internal:11434" \
  kb-milvus:3.0.2 python "$@"
