#!/bin/sh
# Entrypoint for MkDocs container: runs both the dev server and the build trigger.

# Start the build trigger server in the background
python /scripts/mkdocs-build-trigger.py &
BUILD_PID=$!

# Start MkDocs serve — restart it on crash so the build trigger stays alive
while true; do
  mkdocs serve --dev-addr=0.0.0.0:8000 --watch-theme --livereload || true
  echo "MkDocs serve exited, restarting in 5s..."
  sleep 5
done
