Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Download entrypoint.sh from HuggingFaceTB/smol-training-playbook: direct link, hf CLI and curl.
- Browser
- Download file 1.74 kB
-
https://huggingface.co/spaces/HuggingFaceTB/smol-training-playbook/resolve/main/entrypoint.sh
- Command line
-
hf download hf://spaces/HuggingFaceTB/smol-training-playbook/entrypoint.sh
-
curl -L -o entrypoint.sh https://huggingface.co/spaces/HuggingFaceTB/smol-training-playbook/resolve/main/entrypoint.sh
1.74 kB
| set -e | |
| echo "๐ Starting Hugging Face Space..." | |
| # Ensure proper permissions for the app directory at runtime | |
| echo "๐ง Setting up permissions..." | |
| chmod -R 755 /app/src/content/assets 2>/dev/null || echo "โ ๏ธ Could not set permissions (non-critical)" | |
| # Check if Notion import is enabled and token is available | |
| if [ "${ENABLE_NOTION_IMPORT:-false}" = "true" ] && [ -n "$NOTION_TOKEN" ] && [ -n "$NOTION_PAGE_ID" ]; then | |
| echo "๐ Notion import enabled - fetching content from Notion..." | |
| echo " Page ID: $NOTION_PAGE_ID" | |
| cd /app | |
| # Run notion import | |
| if npm run notion:import 2>&1; then | |
| echo "โ Notion import completed successfully!" | |
| # Rebuild the site with new content | |
| echo "๐จ Rebuilding site with Notion content..." | |
| npm run build 2>&1 | |
| # Generate PDF | |
| echo "๐ Generating PDF..." | |
| npm run export:pdf -- --theme=light --wait=full 2>&1 || echo "โ ๏ธ PDF generation failed (non-critical)" | |
| echo "โ Site rebuilt and ready!" | |
| else | |
| echo "โ ๏ธ Notion import failed - using pre-built content from build time" | |
| fi | |
| else | |
| if [ "${ENABLE_NOTION_IMPORT:-false}" = "true" ]; then | |
| echo "โ ๏ธ Notion import enabled but NOTION_TOKEN or NOTION_PAGE_ID not found" | |
| echo " NOTION_TOKEN: ${NOTION_TOKEN:+SET}${NOTION_TOKEN:-NOT SET}" | |
| echo " NOTION_PAGE_ID: ${NOTION_PAGE_ID:+SET}${NOTION_PAGE_ID:-NOT SET}" | |
| echo " โ Using pre-built content from build time" | |
| else | |
| echo "โญ๏ธ Notion import disabled - using pre-built content from build time" | |
| fi | |
| fi | |
| # Start nginx | |
| echo "๐ Starting nginx on port 8080..." | |
| exec nginx -g 'daemon off;' | |