# Use a base image that supports Python and includes Tesseract FROM python:3.9-slim # Set environment variables ENV PYTHONUNBUFFERED 1 ENV FLASK_APP app.py ENV APP_HOME /app # Install Tesseract and its dependencies RUN apt-get update && apt-get install --no-install-recommends -y \ tesseract-ocr tesseract-ocr-rus poppler-utils python3-opencv && \ rm -rf /var/lib/apt/lists/* # Create and set the working directory RUN mkdir /var/www RUN mkdir /var/www/tmp RUN chmod a+w /var/www/tmp RUN groupadd -r flaskuser && useradd -r -g flaskuser flaskuser ENV HOME /var/www WORKDIR /var/www COPY . /var/www RUN pip install --no-cache-dir -r requirements.txt USER flaskuser EXPOSE 7860 # Run the Flask application CMD flask run --host=0.0.0.0 --port=7860