AbuAlone09 commited on
Commit
dcacd47
·
verified ·
1 Parent(s): 72e74f3

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -13
Dockerfile CHANGED
@@ -1,30 +1,32 @@
1
  FROM python:3.12-slim
2
 
3
- # Cài đặt công cụ giải nén và ffmpeg
4
  RUN apt-get update && apt-get install -y p7zip-full ffmpeg && rm -rf /var/lib/apt/lists/*
5
 
6
  WORKDIR /app
7
  COPY . .
8
 
9
- # Cài đặt thư viện: Đã thêm 'toml' để xử lỗi thiếu module của hệ thống lõi
10
  RUN pip install --no-cache-dir \
11
- gradio spaces \
12
  loguru pandas numpy pillow requests \
13
  pydantic pydantic-settings g4f azure-cognitiveservices-speech \
14
  edge-tts openai python-dotenv moviepy httpx curl_cffi \
15
  toml
16
 
17
- # SỬA LỖI QUAN TRỌNG: Tạo và cấp quyền cho thư mục cookies của g4f
18
  RUN mkdir -p /app/har_and_cookies && chmod -R 777 /app/har_and_cookies
19
 
20
  ENV PYTHONPATH="/app:/app/webui:/tmp/core_engine:$PYTHONPATH"
21
  ENV PYTHONUNBUFFERED=1
22
 
23
- # GIỮ NGUYÊN TOÀN BỘ CƠ CHẾ BẢO MẬT VÀ GIẢI NÉN TỪ SECRET
 
 
24
  CMD ["python", "-c", "import os, subprocess, sys, base64\n\
25
  def run():\n\
26
  try:\n\
27
- # Cấp quyền ghi cho tmp để tránh lỗi file hệ thống\n\
28
  subprocess.run('chmod -R 777 /tmp', shell=True)\n\
29
  \n\
30
  sid = os.environ.get('SPACE_ID', '')\n\
@@ -39,15 +41,11 @@ def run():\n\
39
  os.makedirs('/tmp/core_engine', exist_ok=True)\n\
40
  subprocess.run(f'7z x source.7z -p{pwd} -o/tmp/core_engine -y', shell=True)\n\
41
  \n\
42
- target = '/app/webui/run_app.py'\n\
43
- if not os.path.exists(target):\n\
44
- for root, dirs, files in os.walk('/app'):\n\
45
- if 'run_app.py' in files:\n\
46
- target = os.path.join(root, 'run_app.py')\n\
47
- break\n\
48
  \n\
49
  if os.path.exists(target):\n\
50
- # Chạy file giao diện đã chuyển đổi sang Gradio\n\
51
  os.execlp('python', 'python', target)\n\
52
  else:\n\
53
  sys.exit(1)\n\
 
1
  FROM python:3.12-slim
2
 
3
+ # Cài đặt công cụ giải nén và ffmpeg (Giữ nguyên gốc)
4
  RUN apt-get update && apt-get install -y p7zip-full ffmpeg && rm -rf /var/lib/apt/lists/*
5
 
6
  WORKDIR /app
7
  COPY . .
8
 
9
+ # ĐÃ CHUYỂN ĐỔI: Gỡ gradio/spaces -> Thêm fastapi, uvicorn, python-multipart để chạy Custom Web UI
10
  RUN pip install --no-cache-dir \
11
+ fastapi uvicorn python-multipart \
12
  loguru pandas numpy pillow requests \
13
  pydantic pydantic-settings g4f azure-cognitiveservices-speech \
14
  edge-tts openai python-dotenv moviepy httpx curl_cffi \
15
  toml
16
 
17
+ # SỬA LỖI QUAN TRỌNG: Tạo và cấp quyền cho thư mục cookies của g4f (Giữ nguyên gốc)
18
  RUN mkdir -p /app/har_and_cookies && chmod -R 777 /app/har_and_cookies
19
 
20
  ENV PYTHONPATH="/app:/app/webui:/tmp/core_engine:$PYTHONPATH"
21
  ENV PYTHONUNBUFFERED=1
22
 
23
+ EXPOSE 7860
24
+
25
+ # GIỮ NGUYÊN TOÀN BỘ CƠ CHẾ BẢO MẬT VÀ GIẢI NÉN TỪ SECRET - CHỈ TRỎ TARGET SANG FASTAPI
26
  CMD ["python", "-c", "import os, subprocess, sys, base64\n\
27
  def run():\n\
28
  try:\n\
29
+ # Cấp quyền ghi cho tmp để tránh lỗi file hệ thống (Giữ nguyên gốc)\n\
30
  subprocess.run('chmod -R 777 /tmp', shell=True)\n\
31
  \n\
32
  sid = os.environ.get('SPACE_ID', '')\n\
 
41
  os.makedirs('/tmp/core_engine', exist_ok=True)\n\
42
  subprocess.run(f'7z x source.7z -p{pwd} -o/tmp/core_engine -y', shell=True)\n\
43
  \n\
44
+ # Đã cập nhật Target: Trỏ thẳng về file app.py (FastAPI Web UI) nằm ở thư mục gốc ngoài vỏ\n\
45
+ target = '/app/app.py'\n\
 
 
 
 
46
  \n\
47
  if os.path.exists(target):\n\
48
+ # Kích hoạt chạy Server Custom Web UI\n\
49
  os.execlp('python', 'python', target)\n\
50
  else:\n\
51
  sys.exit(1)\n\