Spaces:
Runtime error
Runtime error
| FROM python:3.10-slim | |
| WORKDIR /app | |
| # Install system dependencies (git is needed for some transformers models) | |
| RUN apt-get update && \ | |
| apt-get install -y git && \ | |
| apt-get clean && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # Create a directory for cache that will be writable by the user | |
| RUN mkdir -p /cache && chmod a+rwx /cache | |
| # Set environment variables | |
| ENV HF_HOME=/cache | |
| ENV PYTHONUNBUFFERED=1 | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| COPY . . | |
| # Fix permissions (in case you're running as non-root) | |
| RUN chmod a+rwx /app | |
| EXPOSE 7860 | |
| # Run as non-root user for security | |
| RUN useradd -m myuser && chown -R myuser:myuser /app /cache | |
| USER myuser | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |