HNTAI / entrypoint_optimized.sh
sachinchandrankallar's picture
error fix
5dc4520
Raw
History Blame
1.32 kB
#!/bin/bash
echo "[ENTRYPOINT] Starting optimized container startup..."
# Set environment variables to fix identified issues
export OMP_NUM_THREADS=4
export OPENVINO_TELEMETRY_DIR=/tmp/openvino_telemetry
export MPLCONFIGDIR=/tmp/matplotlib
export PRELOAD_GGUF=false
echo "[ENTRYPOINT] Cleaning specific caches only (no chmod /tmp)..."
# Clean only specific cache directories, not entire /tmp
rm -rf /tmp/huggingface/* /tmp/torch/* /tmp/whisper/* || true
echo "[ENTRYPOINT] Preparing writable directories..."
# Create necessary directories with proper permissions
mkdir -p /tmp/uploads /tmp/huggingface /tmp/torch /tmp/whisper /tmp/openvino_telemetry /tmp/matplotlib
# Only chmod specific directories, not entire /tmp
chmod -R 777 /tmp/openvino_telemetry /tmp/matplotlib /tmp/huggingface /tmp/torch /tmp/whisper /tmp/uploads || true
echo "[ENTRYPOINT] Setting up Hugging Face cache persistence..."
# Ensure HF cache is persistent and writable
mkdir -p /app/.cache/huggingface
chmod -R 777 /app/.cache
echo "[ENTRYPOINT] Environment setup complete:"
echo " - OMP_NUM_THREADS: $OMP_NUM_THREADS"
echo " - OPENVINO_TELEMETRY_DIR: $OPENVINO_TELEMETRY_DIR"
echo " - MPLCONFIGDIR: $MPLCONFIGDIR"
echo " - PRELOAD_GGUF: $PRELOAD_GGUF"
echo " - HF_HOME: $HF_HOME"
echo "[ENTRYPOINT] Starting application..."
exec "$@"