Spaces:
Sleeping
Sleeping
| FROM python:3.9-slim | |
| # Install necessary system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| libffi-dev \ | |
| libssl-dev \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create and switch to a non-root user | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| # Set PATH so pip installs to user dir are available | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| WORKDIR /app | |
| # Install Python dependencies | |
| COPY --chown=user ./requirements.txt requirements.txt | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # Copy all app files | |
| COPY --chown=user . /app | |
| # Run the app | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |