File size: 937 Bytes
4e39378
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31fdf15
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# syntax=docker/dockerfile:1
FROM python:3.9-slim

RUN apt-get update && apt-get install -y ffmpeg git && rm -rf /var/lib/apt/lists/*
RUN useradd -m -u 1000 user
WORKDIR /app
RUN chown user:user /app
RUN mkdir -p /tmp/huggingface_cache_ezmary && chown user:user /tmp/huggingface_cache_ezmary
USER user
ENV PATH="/home/user/.local/bin:$PATH"

RUN --mount=type=secret,id=GITHUB_TOKEN,mode=0444,required=true \
    git clone https://oauth2:$(cat /run/secrets/GITHUB_TOKEN)@github.com/Hamed744/Podcast.git .

RUN pip install --no-cache-dir -r requirements.txt
EXPOSE 7860
ENV PORT=7860
ENV PYTHONUNBUFFERED=1

# تغییر مهم: استفاده از ۱ ورکر برای حفظ حافظه و افزایش threads به ۱۰۰ برای پردازش همزمان و جلوگیری از هنگ کردن
CMD ["gunicorn", "--workers", "1", "--threads", "100", "--worker-class", "gthread", "--bind", "0.0.0.0:7860", "--timeout", "1200", "app:app"]