Spaces:
Sleeping
Sleeping
| # Use Python 3.10 as base | |
| FROM python:3.10 | |
| # 1. Install System Dependencies (Poppler for images) | |
| USER root | |
| RUN apt-get update && apt-get install -y \ | |
| poppler-utils \ | |
| ffmpeg \ | |
| libsm6 \ | |
| libxext6 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # 2. Set up a new user "user" (Security requirement for HF Spaces) | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # 3. Set Working Directory | |
| WORKDIR $HOME/app | |
| # 4. Copy Dependencies | |
| COPY --chown=user requirements.txt requirements.txt | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| # 5. Copy the Application Code & Data | |
| COPY --chown=user . . | |
| # 6. Expose the Port (Hugging Face expects port 7860) | |
| EXPOSE 7860 | |
| # 7. Start the App | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |