fix(downloader): chain fallback aria2c-curl-native + timeouts

This commit is contained in:
vrubelroman 2026-06-04 21:30:37 +00:00
parent a9d1ffc864
commit c4d4a77229
2 changed files with 135 additions and 114 deletions

View file

@ -1,28 +1,9 @@
FROM python:3.11-slim
# Устанавливаем зависимости для yt-dlp (включая Node.js для JS runtime)
RUN apt-get update && apt-get install -y \
ffmpeg \
wget \
nodejs \
npm \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y ffmpeg wget curl aria2 nodejs npm && rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Копируем requirements и устанавливаем зависимости
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Копируем код приложения
COPY . .
# Создаем директорию для загрузок
RUN mkdir -p downloads
ENV PYTHONUNBUFFERED=1
# Gunicorn: 1 worker (последовательная обработка), без таймаута
# Порт берется из переменной окружения PORT (по умолчанию 5000)
CMD sh -c "gunicorn --workers=1 --timeout=0 --bind=0.0.0.0:${PORT:-5000} app:app"
CMD sh -c "gunicorn --workers=1 --timeout=600 --preload --bind=0.0.0.0:\${PORT:-5000} app:app"