FROM python:3.9-slim # Install Tesseract and Git RUN apt-get update && apt-get install -y \ tesseract-ocr \ libtesseract-dev \ git \ && rm -rf /var/lib/apt/lists/* # Create a non-root user RUN useradd -m appuser WORKDIR /app COPY . /app # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Change ownership of the /app directory to appuser RUN chown -R appuser:appuser /app # Switch to the non-root user USER appuser EXPOSE 7861 CMD ["python", "main.py"]