gpfsagent/run.sh
Laurence Horrocks-Barlow 0d75d73c23 Add Docker, bash launcher, and Linux-first README
Lets the project be served as a web app from a Linux host in one command:
- Dockerfile (python:3.12-slim + non-root user + streamlit healthcheck)
- docker-compose.yml with env_file, restart policy, configurable HOST_PORT,
  and an optional CA-bundle volume for self-signed GPFS GUIs
- .dockerignore to keep the image lean
- run.sh for native (non-Docker) runs: creates a venv on first use and
  launches either the Streamlit UI (default) or the REPL
- .gitattributes pins LF line endings on shell/yaml/py so scripts stay
  executable when checked out on Linux from a Windows host
- README rewritten with Linux/Docker quick starts in front, Windows behind

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-20 13:05:30 +01:00

37 lines
826 B
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")"
if [[ ! -f .env ]]; then
echo "No .env found. Copy .env.example to .env and edit it first." >&2
exit 1
fi
if [[ ! -d .venv ]]; then
echo "Creating virtualenv at .venv..."
python3 -m venv .venv
.venv/bin/pip install -q --upgrade pip
.venv/bin/pip install -q -r requirements.txt
fi
MODE="${1:-web}"
HOST="${HOST:-0.0.0.0}"
PORT="${PORT:-8501}"
case "$MODE" in
web)
exec .venv/bin/streamlit run gpfs_agent/web.py \
--server.address "$HOST" \
--server.port "$PORT" \
--server.headless true \
--browser.gatherUsageStats false
;;
cli|repl)
exec .venv/bin/python -m gpfs_agent
;;
*)
echo "Usage: $0 [web|cli]" >&2
exit 2
;;
esac