update entry point
Browse files- entrypoint.sh +42 -0
entrypoint.sh
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
set -e
|
| 3 |
+
|
| 4 |
+
echo "π Starting Hugging Face Space..."
|
| 5 |
+
|
| 6 |
+
# Check if Notion import is enabled and token is available
|
| 7 |
+
if [ "${ENABLE_NOTION_IMPORT:-false}" = "true" ] && [ -n "$NOTION_TOKEN" ] && [ -n "$NOTION_PAGE_ID" ]; then
|
| 8 |
+
echo "π Notion import enabled - fetching content from Notion..."
|
| 9 |
+
echo " Page ID: $NOTION_PAGE_ID"
|
| 10 |
+
|
| 11 |
+
cd /app
|
| 12 |
+
|
| 13 |
+
# Run notion import
|
| 14 |
+
if npm run notion:import 2>&1; then
|
| 15 |
+
echo "β
Notion import completed successfully!"
|
| 16 |
+
|
| 17 |
+
# Rebuild the site with new content
|
| 18 |
+
echo "π¨ Rebuilding site with Notion content..."
|
| 19 |
+
npm run build 2>&1
|
| 20 |
+
|
| 21 |
+
# Generate PDF
|
| 22 |
+
echo "π Generating PDF..."
|
| 23 |
+
npm run export:pdf -- --theme=light --wait=full 2>&1 || echo "β οΈ PDF generation failed (non-critical)"
|
| 24 |
+
|
| 25 |
+
echo "β
Site rebuilt and ready!"
|
| 26 |
+
else
|
| 27 |
+
echo "β οΈ Notion import failed - using pre-built content from build time"
|
| 28 |
+
fi
|
| 29 |
+
else
|
| 30 |
+
if [ "${ENABLE_NOTION_IMPORT:-false}" = "true" ]; then
|
| 31 |
+
echo "β οΈ Notion import enabled but NOTION_TOKEN or NOTION_PAGE_ID not found"
|
| 32 |
+
echo " NOTION_TOKEN: ${NOTION_TOKEN:+SET}${NOTION_TOKEN:-NOT SET}"
|
| 33 |
+
echo " NOTION_PAGE_ID: ${NOTION_PAGE_ID:+SET}${NOTION_PAGE_ID:-NOT SET}"
|
| 34 |
+
echo " β Using pre-built content from build time"
|
| 35 |
+
else
|
| 36 |
+
echo "βοΈ Notion import disabled - using pre-built content from build time"
|
| 37 |
+
fi
|
| 38 |
+
fi
|
| 39 |
+
|
| 40 |
+
# Start nginx
|
| 41 |
+
echo "π Starting nginx on port 8080..."
|
| 42 |
+
exec nginx -g 'daemon off;'
|