# Use the correct Python version (3.10) FROM python:3.10 # Install system dependencies including poppler-utils for pdf2image RUN apt-get update && apt-get install -y \ build-essential \ libssl-dev \ ca-certificates \ libgl1 \ poppler-utils && \ rm -rf /var/lib/apt/lists/* # Create a user for non-root operation RUN useradd -m -u 1000 user USER user # Set the PATH to the user’s local bin directory ENV PATH="/home/user/.local/bin:$PATH" # Set the working directory to /app WORKDIR /app # Copy the requirements.txt and install Python dependencies COPY --chown=user ./requirements.txt requirements.txt # Ensure pip is up-to-date before installing requirements RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir --upgrade -r requirements.txt # Copy the rest of the application code COPY --chown=user . /app # Expose the port and run the app with Uvicorn CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]