| FROM python:3.11.13 | |
| # Install Tesseract OCR and its dependencies | |
| RUN apt-get update \ | |
| && apt-get install -y tesseract-ocr libtesseract-dev libleptonica-dev \ | |
| && apt-get clean \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Install Python dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Create a new user and switch to it | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=$PATH:/home/user/.local/bin | |
| # Set working directory | |
| WORKDIR $HOME/app | |
| # Copy application files | |
| COPY --chown=user . $HOME/app | |
| CMD ["python", "app.py"] | |