| # Use Python 3.10 (Stable for LangChain & Flashrank) | |
| FROM python:3.10-slim | |
| # Set the working directory to /app | |
| WORKDIR /app | |
| # Install system dependencies (needed for compiling packages like flashrank) | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy requirements first to cache dependencies | |
| COPY requirements.txt . | |
| # Install Python dependencies | |
| # --no-cache-dir keeps the image size smaller | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy all your code (app_1.py, src/, templates/, api.py) into the container | |
| COPY . . | |
| # Create writable directories for the database and file uploads | |
| # The 'chmod -R 777' gives the container permission to write here | |
| RUN mkdir -p /app/chroma_db && chmod -R 777 /app/chroma_db | |
| RUN mkdir -p /app/Uploads && chmod -R 777 /app/Uploads | |
| # Tell Docker that the container will listen on port 7860 | |
| EXPOSE 7860 | |
| # --- The Command to Run Your App --- | |
| # We use Gunicorn, a production-grade server | |
| # It looks for the 'app_1.py' file and the 'app' object inside it | |
| # --timeout 300 gives your RAG system 5 minutes to respond before timing out | |
| CMD ["gunicorn", "-b", "0.0.0.0:7860", "app_1:app", "--timeout", "300"] |