| # Use an official lightweight Python image. | |
| FROM python:3.9-slim | |
| # Install system dependencies (poppler-utils is required by pdf2image) | |
| RUN apt-get update && apt-get install -y poppler-utils && rm -rf /var/lib/apt/lists/* | |
| # Set the working directory. | |
| WORKDIR /app | |
| # Copy the requirements file and install dependencies. | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the rest of the application code. | |
| COPY . . | |
| # Expose the port the app runs on. | |
| EXPOSE 7860 | |
| # Command to run the FastAPI app with uvicorn. | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |