Spaces:
Sleeping
Sleeping
| FROM python:3.11-slim | |
| # Create a non-root user | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| WORKDIR /app | |
| # Install system dependencies (must be root) | |
| USER root | |
| RUN apt-get update && apt-get install -y \ | |
| libgl1 \ | |
| libglib2.0-0 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| USER user | |
| # Copy requirements | |
| COPY --chown=user requirements.txt . | |
| # Install dependencies | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| # Copy the rest of the code | |
| COPY --chown=user . . | |
| # Expose the port FastAPI runs on | |
| EXPOSE 7860 | |
| # Command to run the application | |
| CMD ["python", "app.py"] | |