File size: 828 Bytes
d602994
bcdcaab
 
1acd7aa
bcdcaab
 
 
 
1acd7aa
bcdcaab
 
1acd7aa
bcdcaab
 
 
d602994
1acd7aa
 
 
 
d602994
1acd7aa
 
 
 
 
 
bcdcaab
1acd7aa
 
078c87e
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
# Use Python 3.9 as the base image 
FROM python:3.9

# Create a user with ID 1000
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"

# Set the working directory
WORKDIR /app

# Copy the requirements.txt file and install dependencies
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# Install system dependencies needed for OpenCV, Tesseract, and other libraries
USER root
RUN apt-get update && apt-get install -y \
    libgl1-mesa-glx \
    libglib2.0-0 \
    tesseract-ocr \
    && rm -rf /var/lib/apt/lists/*

# Return to the user 'user' for safety
USER user

# Copy the entire app directory to the container
COPY --chown=user . /app

# Set the command to run the app with Gunicorn
CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app"]