jkh32499 commited on
Commit
004a80a
·
verified ·
1 Parent(s): 971f1c7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +41 -1
Dockerfile CHANGED
@@ -1 +1,41 @@
1
- test
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9-slim
2
+
3
+
4
+ # Install system dependencies for building PyQt5 and OpenCV
5
+ RUN apt-get update && apt-get install -y \
6
+ build-essential \
7
+ libgl1 \
8
+ libglib2.0-0 \
9
+ && rm -rf /var/lib/apt/lists/*
10
+
11
+ # Install dependencies and set up the environment for dependency installation
12
+ WORKDIR /code
13
+ COPY ./requirements.txt /code/requirements.txt
14
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
15
+
16
+ # Create a non-root user (with UID 1000) to avoid permission issues
17
+ RUN useradd -m -u 1000 user
18
+
19
+ USER user
20
+ ENV HOME=/home/user \
21
+ PATH=/home/user/.local/bin:$PATH
22
+
23
+ # Set up the working directory for the application
24
+ WORKDIR $HOME/app
25
+
26
+ # Create writable directories for InsightFace models and Matplotlib config
27
+ RUN mkdir -p $HOME/app/insightface_models $HOME/app/.config/matplotlib
28
+
29
+ # Set environment variables so that InsightFace and Matplotlib use the writable directories
30
+ ENV INSIGHTFACE_HOME=$HOME/app/insightface_models
31
+ ENV MPLCONFIGDIR=$HOME/app/.config/matplotlib
32
+ ENV FLASK_APP=app.py
33
+
34
+ # Copy the application code (ensuring proper ownership)
35
+ COPY --chown=user . $HOME/app
36
+
37
+ # Expose the port your Flask app will run on
38
+ EXPOSE 7890
39
+
40
+ # Command to run the Flask application
41
+ CMD ["flask", "run", "--host=0.0.0.0", "--port", "7860"]