Akwbw commited on
Commit
037fdc7
·
verified ·
1 Parent(s): 3f9fd9e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -8
Dockerfile CHANGED
@@ -1,7 +1,7 @@
1
- # Base Image: Python 3.9 on Debian Bullseye (Stable, No errors)
2
  FROM python:3.9-slim-bullseye
3
 
4
- # 1. Install System Dependencies (CairoSVG ke liye zaroori)
5
  RUN apt-get update && apt-get install -y \
6
  libcairo2 \
7
  libpango-1.0-0 \
@@ -11,7 +11,7 @@ RUN apt-get update && apt-get install -y \
11
  shared-mime-info \
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
- # 2. Setup User (Hugging Face security ke liye zaroori hai)
15
  RUN useradd -m -u 1000 user
16
  USER user
17
  ENV PATH="/home/user/.local/bin:$PATH"
@@ -19,16 +19,19 @@ ENV PATH="/home/user/.local/bin:$PATH"
19
  # 3. Working Directory
20
  WORKDIR /app
21
 
22
- # 4. Copy Requirements & Install
23
  COPY --chown=user requirements.txt requirements.txt
24
  RUN pip install --no-cache-dir --upgrade pip && \
25
  pip install --no-cache-dir -r requirements.txt
26
 
27
- # 5. Copy Application Code
28
  COPY --chown=user app.py app.py
29
 
30
- # 6. Expose Port 7860 (Hugging Face ka Default Port)
31
  EXPOSE 7860
32
 
33
- # 7. Start Gunicorn Server on Port 7860
34
- CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app"]
 
 
 
 
1
+ # Base Image (Stable Bullseye)
2
  FROM python:3.9-slim-bullseye
3
 
4
+ # 1. Install System Dependencies
5
  RUN apt-get update && apt-get install -y \
6
  libcairo2 \
7
  libpango-1.0-0 \
 
11
  shared-mime-info \
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
+ # 2. Setup User for Hugging Face Security
15
  RUN useradd -m -u 1000 user
16
  USER user
17
  ENV PATH="/home/user/.local/bin:$PATH"
 
19
  # 3. Working Directory
20
  WORKDIR /app
21
 
22
+ # 4. Copy & Install Requirements
23
  COPY --chown=user requirements.txt requirements.txt
24
  RUN pip install --no-cache-dir --upgrade pip && \
25
  pip install --no-cache-dir -r requirements.txt
26
 
27
+ # 5. Copy App Code
28
  COPY --chown=user app.py app.py
29
 
30
+ # 6. Expose Port 7860
31
  EXPOSE 7860
32
 
33
+ # 7. Start Command (UPDATED FOR STABILITY)
34
+ # --timeout 300: 5 minute tak kill nahi karega
35
+ # --workers 1: Sirf 1 worker chalega taake RAM out of memory na ho
36
+ # --threads 8: Speed ke liye threads use honge
37
+ CMD ["gunicorn", "-b", "0.0.0.0:7860", "--timeout", "300", "--workers", "1", "--threads", "8", "app:app"]