| # Use Python 3.11 (to match your local environment) | |
| FROM python:3.11-slim | |
| WORKDIR /app | |
| # Install build tools | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| COPY . . | |
| # Create writable directories for the database and uploads | |
| RUN mkdir -p /app/chroma_db && chmod -R 777 /app/chroma_db | |
| RUN mkdir -p /app/Uploads && chmod -R 777 /app/Uploads | |
| # RUN mkdir -p /app/flask_session ... <--- REMOVED | |
| EXPOSE 7860 | |
| # We add "--workers 1" to force a single worker. | |
| CMD ["gunicorn", "--workers", "1", "-b", "0.0.0.0:7860", "app:app", "--timeout", "300"] |