Spaces:
Sleeping
Sleeping
| FROM python:3.10-slim | |
| # Create a non-root user | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| WORKDIR /app | |
| # Copy requirements first for better caching | |
| COPY --chown=user ./requirements.txt requirements.txt | |
| RUN pip install --no-cache-dir --user -r requirements.txt | |
| # Copy the rest of the application | |
| COPY --chown=user . /app | |
| # Install the package in development mode | |
| RUN pip install --no-cache-dir --user -e . | |
| # Expose the port | |
| EXPOSE 7860 | |
| # Set environment variables | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV PORT=7860 | |
| # Run the FastAPI application with uvicorn | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |