File size: 898 Bytes
7e7a010
b631b7d
a68743b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2e07be3
a68743b
 
 
 
7e7a010
 
 
 
 
fd9eea9
7e7a010
 
fd9eea9
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
# Start with a base Python image
FROM python:3.9

# Install required system dependencies for OpenCV
RUN apt-get update && apt-get install -y \
    libgl1-mesa-glx \
    libglib2.0-0 \
    libsm6 \
    libxext6 \
    libxrender-dev \
    && rm -rf /var/lib/apt/lists/*

# Create a non-root user to run the app
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"

# Set the working directory
WORKDIR /app

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

# Copy the rest of the application code
COPY --chown=user . /app

# Set the environment variable for Flask
ENV FLASK_APP=app.py
ENV FLASK_ENV=production

# Expose the port that the Flask app runs on
EXPOSE 8080

# Set the command to start the application using Gunicorn with Eventlet
CMD ["python", "app.py"]