Z User commited on
Commit
b39e778
·
1 Parent(s): f350839

Add Dockerfile and update download directory for cloud deployment

Browse files
Files changed (4) hide show
  1. Dockerfile +34 -0
  2. core/cookie_manager.py +1 -1
  3. desktop/main.py +2 -2
  4. requirements.txt +2 -2
Dockerfile ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 1. استخدام نسخة بايثون رسمية ومستقرة كقاعدة للمشروع
2
+ FROM python:3.11-slim
3
+
4
+ # 2. تثبيت أدوات النظام الأساسية ومترجمات C و أداة FFmpeg لدمج الصوت والفيديو
5
+ RUN apt-get update && apt-get install -y --no-install-recommends \
6
+ build-essential \
7
+ curl \
8
+ git \
9
+ ffmpeg \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ # 3. تثبيت لغة Rust داخل الحاوية لتخطي مشكلة بناء مكتبة pydantic-core
13
+ RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
14
+ ENV PATH="/root/.cargo/bin:${PATH}"
15
+
16
+ # 4. تحديد مجلد العمل الافتراضي داخل السيرفر السحابي
17
+ WORKDIR /app
18
+
19
+ # 5. تهيئة بيئة المجلد المؤقت للتحميلات
20
+ RUN mkdir -p /tmp/downloads && chmod 777 /tmp/downloads
21
+
22
+ # 6. نسخ ملف المكتبات وتحديث أدوات التثبيت
23
+ COPY requirements.txt .
24
+ RUN pip install --no-cache-dir --upgrade pip setuptools wheel
25
+ RUN pip install --no-cache-dir -r requirements.txt
26
+
27
+ # 7. نسخ باقي ملفات المشروع بالكامل إلى داخل السيرفر
28
+ COPY . .
29
+
30
+ # 8. فتح المنفذ (Port) الافتراضي المتوافق مع الكود الخاص بك
31
+ EXPOSE 8555
32
+
33
+ # 9. أمر تشغيل خادم FastAPI
34
+ CMD ["python", "desktop/main.py"]
core/cookie_manager.py CHANGED
@@ -9,7 +9,7 @@ from typing import Optional
9
 
10
  logger = logging.getLogger(__name__)
11
 
12
- COOKIES_DIR = os.path.join(os.path.expanduser("~"), ".yt-dlp", "cookies")
13
  COOKIES_FILE = os.path.join(COOKIES_DIR, "youtube_cookies.txt")
14
 
15
 
 
9
 
10
  logger = logging.getLogger(__name__)
11
 
12
+ COOKIES_DIR = os.path.join("/tmp", ".yt-dlp", "cookies")
13
  COOKIES_FILE = os.path.join(COOKIES_DIR, "youtube_cookies.txt")
14
 
15
 
desktop/main.py CHANGED
@@ -43,8 +43,8 @@ app.add_middleware(
43
  allow_headers=["*"],
44
  )
45
 
46
- # مجلد التحميل
47
- DOWNLOAD_DIR = os.path.join(os.path.expanduser("~"), "YouTube_Downloads")
48
  os.makedirs(DOWNLOAD_DIR, exist_ok=True)
49
 
50
  # محمل الفيديو
 
43
  allow_headers=["*"],
44
  )
45
 
46
+ # مجلد التحميل - استخدام /tmp للنشر السحابي
47
+ DOWNLOAD_DIR = "/tmp/downloads"
48
  os.makedirs(DOWNLOAD_DIR, exist_ok=True)
49
 
50
  # محمل الفيديو
requirements.txt CHANGED
@@ -1,9 +1,9 @@
1
  # YouTube Downloader - Requirements
2
- # المتطلبات الأساسية
3
 
4
  yt-dlp>=2024.0.0,<2026.0.0
5
  fastapi>=0.100.0,<1.0.0
6
  uvicorn>=0.23.0,<1.0.0
7
  aiofiles>=23.0,<25.0.0
8
- flet>=0.21.0,<1.0.0
9
  httpx>=0.25.0,<1.0.0
 
 
1
  # YouTube Downloader - Requirements
2
+ # المتطلبات الأساسية للنشر السحابي
3
 
4
  yt-dlp>=2024.0.0,<2026.0.0
5
  fastapi>=0.100.0,<1.0.0
6
  uvicorn>=0.23.0,<1.0.0
7
  aiofiles>=23.0,<25.0.0
 
8
  httpx>=0.25.0,<1.0.0
9
+ python-multipart>=0.0.6