Spaces:
Sleeping
Sleeping
Upload scripts/entrypoint.sh with huggingface_hub
Browse files- scripts/entrypoint.sh +15 -13
scripts/entrypoint.sh
CHANGED
|
@@ -1,17 +1,19 @@
|
|
| 1 |
#!/bin/bash
|
| 2 |
-
|
| 3 |
-
# This script logs the immediate startup state to /data before the python app loads.
|
| 4 |
-
# This helps diagnose if the container starts but the python app crashes silently.
|
| 5 |
|
| 6 |
-
#
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
python --version >> /data/startup_log.txt 2>&1
|
| 12 |
-
echo "[$(date)] ENTRYPOINT: Installing requirements..." >> /data/startup_log.txt
|
| 13 |
-
pip install -r requirements.txt >> /data/startup_log.txt 2>&1
|
| 14 |
-
echo "[$(date)] ENTRYPOINT: Starting application..." >> /data/startup_log.txt
|
| 15 |
|
| 16 |
-
#
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
#!/bin/bash
|
| 2 |
+
set -e
|
|
|
|
|
|
|
| 3 |
|
| 4 |
+
# 1. SURVIVAL: Mount dataset for persistent memory
|
| 5 |
+
echo "Mounting Dataset Storage..."
|
| 6 |
+
if [ ! -d /data/data ]; then
|
| 7 |
+
echo "Initializing fresh dataset storage..."
|
| 8 |
+
else
|
| 9 |
+
echo "Restoring from existing dataset storage..."
|
| 10 |
+
fi
|
| 11 |
|
| 12 |
+
# Ensure the state directory exists
|
| 13 |
+
mkdir -p /data/state
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
+
# 2. CAPABILITY: Install latest dependencies if needed
|
| 16 |
+
echo "Environment ready. Starting Application..."
|
| 17 |
+
|
| 18 |
+
# 3. Execute the main application
|
| 19 |
+
exec python app.py
|