rafiaashraf commited on
Commit
762f359
·
verified ·
1 Parent(s): 82145a7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -26
Dockerfile CHANGED
@@ -1,38 +1,36 @@
1
- # Use a compatible Python base image
2
  FROM python:3.10-slim
3
 
4
- # Set working directory
5
- WORKDIR /app
6
-
7
- # Copy files
8
- COPY . .
9
-
10
  # Install system dependencies
11
  RUN apt-get update && apt-get install -y \
12
- wget \
13
  ffmpeg \
14
- libgl1 \
 
 
15
  && rm -rf /var/lib/apt/lists/*
16
 
17
- # Install Python dependencies
18
- RUN pip install --no-cache-dir -r requirements.txt
 
 
 
 
 
 
 
19
 
20
- # Create writable dirs for matplotlib, fontconfig, and mediapipe models
21
- RUN mkdir -p /tmp/mplconfig /app/.cache/fontconfig /app/models/mediapipe && \
22
- chmod -R 777 /tmp/mplconfig /app/.cache /app/models
23
 
24
- # Download mediapipe model to a writable path
25
- RUN wget -O /app/models/pose_landmark_heavy.tflite \
26
- https://storage.googleapis.com/mediapipe-assets/pose_landmark_heavy.tflite
27
 
28
- # Set environment variables
29
- ENV MPLCONFIGDIR=/tmp/mplconfig
30
- ENV XDG_CACHE_HOME=/app/.cache
31
- ENV FONTCONFIG_PATH=/etc/fonts
32
- ENV HOME=/app
33
 
34
- # Expose the port used by Flask
35
- EXPOSE 8000
36
 
37
- # Command to run the app
38
- CMD ["python", "app.py"]
 
 
1
  FROM python:3.10-slim
2
 
 
 
 
 
 
 
3
  # Install system dependencies
4
  RUN apt-get update && apt-get install -y \
 
5
  ffmpeg \
6
+ libsm6 \
7
+ libxext6 \
8
+ libgl1-mesa-glx \
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
+ # Set environment variables
12
+ ENV MPLCONFIGDIR=/tmp
13
+ ENV MEDIAPIPE_MODEL_DIR=/app/mediapipe_models
14
+
15
+ # Create necessary directories
16
+ RUN mkdir -p /app/mediapipe_models
17
+
18
+ # Set working directory
19
+ WORKDIR /app
20
 
21
+ # Copy files
22
+ COPY . /app
 
23
 
24
+ # Install dependencies
25
+ RUN pip install --upgrade pip
26
+ RUN pip install -r requirements.txt
27
 
28
+ # Create a non-root user and switch to it
29
+ RUN useradd -m appuser
30
+ USER appuser
 
 
31
 
32
+ # Expose port
33
+ EXPOSE 7860
34
 
35
+ # Run Flask app
36
+ CMD ["python", "app.py"]