File size: 758 Bytes
128b2ee
 
 
 
ae09a0d
 
 
128b2ee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39d1490
 
ae09a0d
39d1490
ae09a0d
128b2ee
 
ae09a0d
128b2ee
39d1490
ae09a0d
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
FROM python:3.9

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

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

WORKDIR /app

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

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

# Set Flask environment variables
ENV FLASK_APP=app.py
ENV FLASK_ENV=production
ENV FLASK_RUN_HOST=0.0.0.0
ENV FLASK_RUN_PORT=7860

# Expose port
EXPOSE 7860

# Run Flask application with host and port specified
CMD ["flask", "run", "--host=0.0.0.0", "--port=7860"]