akash1702-eng commited on
Commit
e100c0e
·
verified ·
1 Parent(s): cc68fb6

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -1
Dockerfile CHANGED
@@ -1,10 +1,36 @@
 
1
  FROM python:3.10-slim
2
 
 
 
 
 
 
 
 
3
  WORKDIR /app
 
 
 
 
 
 
 
 
 
 
 
 
4
  COPY . .
5
 
 
 
 
 
6
  RUN pip install --no-cache-dir -r requirements.txt
7
 
 
8
  ENV PORT=7860
9
 
10
- CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]
 
 
1
+ # Use lightweight Python image
2
  FROM python:3.10-slim
3
 
4
+ # Prevent Python from writing pyc files
5
+ ENV PYTHONDONTWRITEBYTECODE=1
6
+
7
+ # Prevent Python from buffering stdout/stderr
8
+ ENV PYTHONUNBUFFERED=1
9
+
10
+ # Set working directory
11
  WORKDIR /app
12
+
13
+ # Install system dependencies required for OpenCV & TensorFlow
14
+ RUN apt-get update && apt-get install -y \
15
+ build-essential \
16
+ libglib2.0-0 \
17
+ libsm6 \
18
+ libxext6 \
19
+ libxrender-dev \
20
+ curl \
21
+ && rm -rf /var/lib/apt/lists/*
22
+
23
+ # Copy project files
24
  COPY . .
25
 
26
+ # Upgrade pip
27
+ RUN pip install --upgrade pip
28
+
29
+ # Install Python dependencies
30
  RUN pip install --no-cache-dir -r requirements.txt
31
 
32
+ # Hugging Face requires port 7860
33
  ENV PORT=7860
34
 
35
+ # Start app using Gunicorn
36
+ CMD ["gunicorn", "--workers=1", "--threads=4", "--timeout=120", "--bind", "0.0.0.0:7860", "app:app"]