tao-shen commited on
Commit
cf982d5
·
verified ·
1 Parent(s): fe18ed7

Upload scripts/entrypoint.sh with huggingface_hub

Browse files
Files changed (1) hide show
  1. scripts/entrypoint.sh +15 -13
scripts/entrypoint.sh CHANGED
@@ -1,17 +1,19 @@
1
  #!/bin/bash
2
- # CRITICAL STARTUP LOGGING
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
- # SURVIVAL FIX: Ensure log directory exists before writing
7
- mkdir -p /data
 
 
 
 
 
8
 
9
- echo "[$(date)] ENTRYPOINT: Starting container initialization..." >> /data/startup_log.txt
10
- echo "[$(date)] ENTRYPOINT: Python version:" >> /data/startup_log.txt
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
- # Run the application and capture ALL output
17
- python app.py >> /data/startup_log.txt 2>&1
 
 
 
 
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