Spaces:
Sleeping
Sleeping
| set -e | |
| echo "=== AlgoVision Two-Space Bootloader ===" | |
| # 1. Validate Token | |
| if [ -z "$HF_TOKEN" ]; then | |
| echo "ERROR: The 'HF_TOKEN' environment variable is empty!" | |
| echo "Please add a Write/Read access token under Space Settings -> Variables and secrets." | |
| exit 1 | |
| fi | |
| # 2. Clone Private Repository | |
| echo "Cloning private source code from AlgoVision-Server..." | |
| rm -rf /tmp/algo_repo | |
| git clone --depth 1 https://oauth2:$HF_TOKEN@huggingface.co/spaces/ldsprgrm/AlgoVision-Server /tmp/algo_repo | |
| # 3. Deploy to /app | |
| echo "Moving private assets to active container space..." | |
| # Copy everything (including hidden files) from /tmp/algo_repo to /app | |
| cp -rp /tmp/algo_repo/. /app/ | |
| rm -rf /tmp/algo_repo | |
| # 4. Set Permissions | |
| chmod +x /app/entrypoint.sh | |
| chmod -R 777 /app | |
| # 5. Hand over control to native entrypoint | |
| echo "Launching AlgoVision Application..." | |
| exec /app/entrypoint.sh | |