File size: 1,064 Bytes
0befbb9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bc26ea4
 
 
 
 
 
 
 
 
 
 
 
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
36
37
FROM python:3.10-slim

ENV PIP_NO_CACHE_DIR=1 \
    HF_HUB_DISABLE_SYMLINKS_WARNING=1

# Use libgl1 (NOT libgl1-mesa-glx) to avoid Debian trixie breakage
RUN apt-get update && apt-get install -y --no-install-recommends \
    git git-lfs ffmpeg libsm6 libxext6 libgl1 cmake rsync curl \
 && git lfs install \
 && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Install Python deps
COPY requirements.txt /app/requirements.txt
RUN python -m pip install --upgrade pip \
 && pip install --no-cache-dir -r /app/requirements.txt

# Copy the app code
COPY . /app

# Spaces auto-assigns $PORT; Gradio binds to it automatically
EXPOSE 7860
CMD ["python", "app.py"]

# Create a shared writable cache dir for HF + Gradio
RUN mkdir -p /data/.cache/huggingface/transformers /data/.cache/huggingface/hub /data/gradio && \
    chmod -R 777 /data

# Route caches to /data
ENV HF_HOME=/data/.cache/huggingface
ENV TRANSFORMERS_CACHE=/data/.cache/huggingface/transformers
ENV HF_HUB_CACHE=/data/.cache/huggingface/hub
ENV GRADIO_TEMP_DIR=/data/gradio
ENV GRADIO_CACHE_DIR=/data/gradio