File size: 1,190 Bytes
c84061a
 
8ef5a0f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0b0e4b8
 
 
 
 
 
 
 
 
 
8ef5a0f
b28492c
8ef5a0f
 
 
 
 
c84061a
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
43
44
ARG CUDA_IMAGE="12.1.1-devel-ubuntu22.04"
FROM nvidia/cuda:${CUDA_IMAGE}

RUN apt-get update && apt-get install -y \
    python3.10 python3-pip \
    tesseract-ocr \
    libtesseract-dev \
    libgl1-mesa-glx \
    poppler-utils \
    && rm -rf /var/lib/apt/lists/*

# Set the working directory in the container
WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y libgl1-mesa-glx

# Copy the dependencies file to the working directory
COPY requirements.txt .

# Install dependencies
RUN pip install --trusted-host pypi.python.org -r requirements.txt

# Copy the content of the local src directory to the working directory
COPY . .

# Create a user to run the application
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

# Set the working directory in the user's home directory
WORKDIR $HOME/app
COPY --chown=user . $HOME/app

# Expose the port number on which the Flask app will run
EXPOSE 7860

# Define environment variable
ENV NAME World

# Command to run on container start
CMD [ "gunicorn", "--workers=1", "--keep-alive=100000000", "--threads=10", "-b", "0.0.0.0:7860", "librarymed.app_librarymed:app" ]