File size: 1,042 Bytes
037fdc7 99c5e1f 3d27cbf 037fdc7 3d27cbf 037fdc7 99c5e1f 3d27cbf 037fdc7 99c5e1f 3d27cbf 037fdc7 99c5e1f 3d27cbf 037fdc7 99c5e1f 3d27cbf 037fdc7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# Base Image (Stable Bullseye)
FROM python:3.9-slim-bullseye
# 1. Install System Dependencies
RUN apt-get update && apt-get install -y \
libcairo2 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libgdk-pixbuf2.0-0 \
libffi-dev \
shared-mime-info \
&& rm -rf /var/lib/apt/lists/*
# 2. Setup User for Hugging Face Security
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
# 3. Working Directory
WORKDIR /app
# 4. Copy & Install Requirements
COPY --chown=user requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# 5. Copy App Code
COPY --chown=user app.py app.py
# 6. Expose Port 7860
EXPOSE 7860
# 7. Start Command (UPDATED FOR STABILITY)
# --timeout 300: 5 minute tak kill nahi karega
# --workers 1: Sirf 1 worker chalega taake RAM out of memory na ho
# --threads 8: Speed ke liye threads use honge
CMD ["gunicorn", "-b", "0.0.0.0:7860", "--timeout", "300", "--workers", "1", "--threads", "8", "app:app"] |