chemistrymath commited on
Commit
0cb46c5
·
verified ·
1 Parent(s): 5988844

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -13
Dockerfile CHANGED
@@ -1,31 +1,32 @@
1
- # Use an official lightweight Python image
2
- FROM python:3.10
3
 
4
- # Set the working directory
5
  WORKDIR /app
6
 
7
- # Install system dependencies required for OpenCV & MediaPipe
8
  RUN apt-get update && apt-get install -y \
9
  libgl1-mesa-glx \
10
  libglib2.0-0 \
11
  ffmpeg \
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
- # Set writable paths for MediaPipe & Matplotlib
15
  ENV MP_MODELS_PATH=/tmp/mediapipe_models
16
  ENV MPLCONFIGDIR=/tmp/matplotlib
17
 
18
- # Ensure writable directories exist
19
- RUN mkdir -p $MP_MODELS_PATH $MPLCONFIGDIR
 
20
 
21
- # Copy all files from the local directory to the container
22
  COPY . .
23
 
24
- # Install Python dependencies
25
- RUN pip install --no-cache-dir -r requirements.txt
 
26
 
27
- # Expose the port Flask will run on
28
  EXPOSE 7860
29
 
30
- # Run the application using Gunicorn (Production Ready)
31
- CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "2", "--timeout", "120", "app:app"]
 
1
+ FROM python:3.10-slim
 
2
 
3
+ # Set working directory
4
  WORKDIR /app
5
 
6
+ # Install system dependencies
7
  RUN apt-get update && apt-get install -y \
8
  libgl1-mesa-glx \
9
  libglib2.0-0 \
10
  ffmpeg \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
+ # Set writable paths for MediaPipe & Matplotlib
14
  ENV MP_MODELS_PATH=/tmp/mediapipe_models
15
  ENV MPLCONFIGDIR=/tmp/matplotlib
16
 
17
+ # Ensure writable directories exist and set permissions
18
+ RUN mkdir -p $MP_MODELS_PATH $MPLCONFIGDIR \
19
+ && chmod -R 777 $MP_MODELS_PATH $MPLCONFIGDIR
20
 
21
+ # Copy application files
22
  COPY . .
23
 
24
+ # Upgrade pip and install dependencies
25
+ RUN pip install --no-cache-dir --upgrade pip \
26
+ && pip install --no-cache-dir -r requirements.txt
27
 
28
+ # Expose port
29
  EXPOSE 7860
30
 
31
+ # Run the application
32
+ CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "2", "--timeout", "120", "app:app"]