# Dockerfile for Tiffin Packer — HF Spaces Compatible # Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker FROM python:3.10-slim # Create non-root user (HF Spaces requirement) RUN useradd -m -u 1000 user ENV PATH="/home/user/.local/bin:$PATH" # System dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ libgl1 \ libglib2.0-0 \ libsm6 \ libxrender1 \ libxext6 \ && rm -rf /var/lib/apt/lists/* # Switch to non-root user USER user WORKDIR /app # Install Python dependencies COPY --chown=user requirements.txt . RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir -r requirements.txt # Copy application code COPY --chown=user . /app # Expose port (HF Spaces default for Docker) EXPOSE 7860 # Health check HEALTHCHECK --interval=30s --timeout=5s --start-period=10s \ CMD python -c "import requests; r=requests.get('http://localhost:7860/health'); r.raise_for_status()" || exit 1 # Run the server CMD ["uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "7860"]