# Use an official Python runtime as a parent image FROM python:3.11-slim # Set the working directory in the container WORKDIR /code # Set a writable cache directory for Hugging Face models ENV HF_HOME=/tmp/.cache/huggingface # --- Install system dependencies including tesseract-ocr --- RUN apt-get update && \ apt-get install -y --no-install-recommends \ tesseract-ocr \ libgl1 \ poppler-utils \ libglib2.0-0 \ libsm6 \ libxrender1 \ libxext6 \ && rm -rf /var/lib/apt/lists/* # Copy the requirements file into the container COPY ./requirements.txt /code/requirements.txt # Install Python packages RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir -r /code/requirements.txt # Copy the rest of your app's code COPY . /code/ # Expose the port the app runs on EXPOSE 7860 # Command to run the uvicorn server for FastAPI CMD ["python", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]