Spaces:
Sleeping
Sleeping
| FROM python:3.11-slim | |
| WORKDIR /code | |
| # Install system dependencies (needed for compiling Python extensions if any) | |
| RUN apt-get update && apt-get install -y gcc g++ && rm -rf /var/lib/apt/lists/* | |
| # Install Hugging Face container dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Create an unprivileged user for security (required by Hugging Face Spaces Docker SDK) | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # Change to the user's home directory context | |
| WORKDIR $HOME/app | |
| # Copy the entire workspace into the container, assigning ownership to 'user' | |
| COPY --chown=user . $HOME/app | |
| # Hugging Face sets the listening port to 7860 | |
| EXPOSE 7860 | |
| # Launch uvicorn wrapping the FastAPI/Gradio app | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |