File size: 972 Bytes
8926270 8da3108 6400353 ae40e7a 6400353 8da3108 6400353 8da3108 bd1a1d1 e09d817 bd1a1d1 54a6977 d1c3bc2 e8b6e40 7b14b11 e2e2fbd bd1a1d1 e1fe138 e09d817 b775946 e09d817 b775946 e09d817 bd1a1d1 9692ec5 bd1a1d1 e09d817 be9ee59 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | FROM python:3.10-slim
# Install required system libraries
RUN apt-get update && apt-get install -y \
tesseract-ocr \
tesseract-ocr-eng \
libgl1-mesa-glx \
libglib2.0-0 \
libgtk2.0-0 \
libatlas-base-dev \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory
WORKDIR /app
# Copy all files to /app
COPY requirements.txt /app/
COPY app.py /app/
COPY fresh_model.pt /app/
COPY another_model.pt /app/
COPY model_2.pt /app/
# Copy index.html to the /app directory
COPY templates/ /app/templates/
# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install --upgrade tensorflow keras gunicorn
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
COPY --chown=user . $HOME/app
# Preload the model to avoid runtime delays
# Expose the port
EXPOSE 8080
# Command to run the app with Gunicorn
CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:7860", "app:app"] |