| # Use an official Python runtime as a parent image | |
| FROM python:3.9-slim | |
| # Set the working directory | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| libgl1-mesa-glx \ | |
| libglib2.0-0 \ | |
| tesseract-ocr \ | |
| tesseract-ocr-eng \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy the requirements file into the container | |
| COPY requirements.txt . | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| RUN mkdir -p /app/uploads && chmod -R 777 /app/uploads | |
| # Copy the rest of the application code into the container | |
| COPY . . | |
| # Make port 8000 available to the world outside this container | |
| EXPOSE 7860 | |
| # Run the application | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |