Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +38 -26
Dockerfile
CHANGED
|
@@ -1,41 +1,53 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
|
| 3 |
-
|
|
|
|
| 4 |
|
| 5 |
-
#
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
-
|
| 8 |
-
|
|
|
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
-
# ---
|
| 12 |
-
#
|
| 13 |
-
RUN mkdir -p
|
| 14 |
/data/.huggingface \
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
ENV HF_HOME=/data/.huggingface
|
|
|
|
| 19 |
ENV HF_DATASETS_CACHE=/data/.cache/huggingface/datasets
|
| 20 |
ENV TRANSFORMERS_CACHE=/data/.cache/huggingface/transformers
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
-
#
|
| 24 |
-
|
| 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 |
-
|
| 29 |
-
|
| 30 |
-
faster-whisper \
|
| 31 |
-
huggingface_hub
|
| 32 |
|
| 33 |
-
#
|
| 34 |
-
COPY
|
| 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 |
-
|
|
|
|
|
|
| 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"]
|