#!/bin/sh # HF Space container entrypoint. Runs sequentially BEFORE gunicorn binds :7860, # so no request can race the migrate/seed. All steps are idempotent. set -e python manage.py migrate --noinput # CREATE EXTENSION vector is a no-op (pre-created in Neon) python manage.py seed_initial_skills # order matters: skills -> roles/resources -> demo users python manage.py seed_initial_roles python manage.py seed_initial_resources python manage.py seed_demo_users # admin password from DEMO_ADMIN_PASSWORD # First boot only (set BUILD_EMBEDDINGS=1): build SBERT skill embeddings so the # sbert NER layer has data. Idempotent; ~15s once models are baked. if [ "$BUILD_EMBEDDINGS" = "1" ]; then python scripts/build_skill_embeddings.py fi exec gunicorn config.wsgi:application \ --bind 0.0.0.0:7860 \ --workers 1 --threads 4 --timeout 300 \ --access-logfile - --error-logfile -