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