AIencoder commited on
Commit
0b7b535
·
verified ·
1 Parent(s): fe98ade

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +38 -26
Dockerfile CHANGED
@@ -1,41 +1,53 @@
1
- FROM python:3.11-slim
 
2
 
3
- WORKDIR /
 
4
 
5
- # 1. Install system tools (Keep your existing dependencies)
6
  RUN apt-get update && apt-get install -y \
7
- curl \
8
- ffmpeg \
 
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
- # --- START OF FIX ---
12
- # 2. Create cache directories on the large /data volume and set permissions [cite: 11]
13
- RUN mkdir -p /data/.cache/huggingface \
14
  /data/.huggingface \
15
- && chmod -R 777 /data
16
-
17
- # 3. Tell Hugging Face to use the /data folder for storage [cite: 11]
 
 
 
 
 
 
 
 
 
18
  ENV HF_HOME=/data/.huggingface
 
19
  ENV HF_DATASETS_CACHE=/data/.cache/huggingface/datasets
20
  ENV TRANSFORMERS_CACHE=/data/.cache/huggingface/transformers
21
- # --- END OF FIX ---
 
 
 
 
22
 
23
- # 4. Install your python libraries (Keep your existing wheels and requirements)
24
- # Try GitHub first, fallback to HuggingFace
25
- RUN pip install https://github.com/Ary5272/llama-cpp-python/releases/download/v0.1.1/llama_cpp_python-0.3.16-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl \
26
- || pip install https://huggingface.co/datasets/AIencoder/llama-cpp-wheels/resolve/main/llama_cpp_python-0.3.16-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
27
 
28
- RUN pip install \
29
- gradio \
30
- faster-whisper \
31
- huggingface_hub
32
 
33
- # 5. Copy app files and start
34
- COPY app.py /app.py
35
- COPY entrypoint.sh /entrypoint.sh
36
- RUN chmod +x /entrypoint.sh
37
 
 
38
  EXPOSE 7860
39
- ENV GRADIO_SERVER_NAME="0.0.0.0"
40
 
41
- ENTRYPOINT ["/entrypoint.sh"]
 
 
1
+ # Use Python 3.10 for compatibility
2
+ FROM python:3.10-slim
3
 
4
+ # Set working directory
5
+ WORKDIR /app
6
 
7
+ # Install system dependencies
8
  RUN apt-get update && apt-get install -y \
9
+ build-essential \
10
+ libopenblas-dev \
11
+ libomp-dev \
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
+ # --- FIX STARTS HERE ---
15
+ # Create cache directories on /data and matplotlib config dir
16
+ RUN mkdir -p \
17
  /data/.huggingface \
18
+ /data/.cache/huggingface/datasets \
19
+ /data/.cache/huggingface/transformers \
20
+ /tmp/matplotlib \
21
+ && chmod -R 777 /data /tmp/matplotlib
22
+
23
+ # Clean any old Hugging Face caches (defensive)
24
+ RUN rm -rf \
25
+ /root/.cache/huggingface \
26
+ /root/.cache/huggingface_hub \
27
+ /root/.cache/huggingface/datasets || true
28
+
29
+ # Set cache environment variables to point at /data
30
  ENV HF_HOME=/data/.huggingface
31
+ ENV HF_HUB_CACHE=/data/.cache/huggingface/hub
32
  ENV HF_DATASETS_CACHE=/data/.cache/huggingface/datasets
33
  ENV TRANSFORMERS_CACHE=/data/.cache/huggingface/transformers
34
+ ENV MPLCONFIGDIR=/tmp/matplotlib
35
+ # --- FIX ENDS HERE ---
36
+
37
+ # Copy requirements file
38
+ COPY requirements.txt /app/requirements.txt
39
 
40
+ # Install dependencies
41
+ RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
 
 
42
 
43
+ # Install PyTorch separately for compatibility
44
+ RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
 
 
45
 
46
+ # Copy application files
47
+ COPY . /app
 
 
48
 
49
+ # Expose port
50
  EXPOSE 7860
 
51
 
52
+ # Run the application
53
+ CMD ["python", "main.py"]