# Use Python 3.10 slim image FROM python:3.10-slim # Set working directory WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ gcc \ g++ \ && rm -rf /var/lib/apt/lists/* # Copy requirements first for better caching COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy application files COPY app.py . COPY templates/ ./templates/ COPY static/ ./static/ COPY embeddings/ ./embeddings/ COPY model/ ./model/ # Expose port EXPOSE 7860 # Set environment variables ENV FLASK_APP=app.py ENV PYTHONUNBUFFERED=1 # Run the application with gunicorn CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "2", "--timeout", "120", "--access-logfile", "-", "--error-logfile", "-", "app:app"]