File size: 1,320 Bytes
3d8b270
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5dc4520
 
3d8b270
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
34
35
#!/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 "$@"