File size: 1,023 Bytes
faf4679
 
acdfb5c
 
447bc57
 
 
 
faf4679
 
 
 
1a8333a
 
acdfb5c
 
1a8333a
 
 
acdfb5c
1a8333a
 
 
 
 
 
 
acdfb5c
faf4679
 
acdfb5c
faf4679
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash

echo "Starting entrypoint script..."

# Attempt to modify permissions of /data to ensure it's writable by the user
# Note: This might not work if /data's permissions are restricted outside the container
chown -R user:user /data

# Authenticate with Hugging Face
export HF_HOME=/home/user/data/hf_cache
echo "Using Hugging Face API token for authentication"

# Navigate to the directory where download_model.py is located
echo "Determining model path..."
cd /home/user/app/utils
echo "Current directory for model download: $(pwd)"

# Execute the download_model script
python download_model.py || { echo "Model download failed"; exit 1; }

# Read the model path from model_path.txt and export it
MODEL_PATH=$(cat /home/user/data/models/model_path.txt)
export MODEL_PATH
echo "@ Entrypoint - MODEL_PATH exported=${MODEL_PATH}"

# Navigate back to the app directory
cd /home/user/app
echo "Returning to app directory: $(pwd)"

# Execute the main command of the container
echo "Executing main command..."
exec "$@"