Phoe2004 commited on
Commit
0d148ef
·
verified ·
1 Parent(s): 3a9972f

Upload 3 files

Browse files
Files changed (3) hide show
  1. Dockerfile +12 -62
  2. app.py +0 -0
  3. requirements.txt +2 -18
Dockerfile CHANGED
@@ -1,73 +1,23 @@
1
  FROM python:3.11-slim
2
 
3
- # System deps + deno (yt-dlp JS challenge solver)
4
- RUN apt-get update && apt-get install -y --no-install-recommends \
5
- ffmpeg git curl unzip \
6
- libass9 libass-dev \
7
- fontconfig \
8
- && curl -fsSL https://deno.land/install.sh | sh \
9
- && rm -rf /var/lib/apt/lists/*
10
-
11
- ENV DENO_INSTALL="/root/.deno"
12
- ENV PATH="$DENO_INSTALL/bin:$PATH"
13
 
14
  WORKDIR /app
15
 
16
- # numpy ကို ဦးစွာ install (torch မတိုင်ခင်)
17
- RUN pip install --no-cache-dir "numpy<2"
18
-
19
- # torch CPU only
20
- RUN pip install --no-cache-dir \
21
- torch==2.2.2+cpu torchaudio==2.2.2+cpu \
22
- --index-url https://download.pytorch.org/whl/cpu
23
-
24
  COPY requirements.txt .
25
  RUN pip install --no-cache-dir -r requirements.txt
26
 
27
- # yt-dlp latest
28
- RUN pip install --no-cache-dir -U "yt-dlp[default,curl-cffi]"
29
- RUN pip install --no-cache-dir openai-whisper
30
-
31
- # Copy all application files (login.html ဖယ်ထုတ်ပြီ — index.html ထဲ ပေါင်းထည့်ပြီးပြီ)
32
- COPY app.py .
33
- COPY run_bot.py .
34
- COPY bot.py .
35
- COPY index.html .
36
- COPY payment.html .
37
- COPY payment_history.html .
38
- COPY privacy.html .
39
- COPY terms.html .
40
- COPY NotoSansMyanmar-Bold.ttf .
41
- COPY m_youtube_com_cookies.txt .
42
- COPY start.sh .
43
- COPY manifest.json .
44
- COPY sw.js .
45
- RUN chmod +x start.sh
46
 
47
- # Create necessary directories
48
- RUN mkdir -p outputs slips temp_prev temp_thumb temp_
 
49
 
50
- # Install NotoSansMyanmar to system fonts + build isolated fonts.conf
51
- RUN mkdir -p /usr/local/share/fonts/myanmar \
52
- && cp /app/NotoSansMyanmar-Bold.ttf /usr/local/share/fonts/myanmar/ \
53
- && fc-cache -fv \
54
- && fc-list | grep -i myanmar || true
55
 
56
- # Write isolated fonts.conf at build time (only Myanmar font dir)
57
- RUN mkdir -p /app/fc_conf && \
58
- printf '<?xml version="1.0"?>\n\
59
- <!DOCTYPE fontconfig SYSTEM "fonts.dtd">\n\
60
- <fontconfig>\n\
61
- <dir>/usr/local/share/fonts/myanmar</dir>\n\
62
- <dir>/app</dir>\n\
63
- <cachedir>/tmp/fc_cache</cachedir>\n\
64
- <config><rescan><int>30</int></rescan></config>\n\
65
- </fontconfig>\n' > /app/fc_conf/fonts.conf
66
-
67
- # Pre-download Whisper 'tiny' model at build time → no delay on first request
68
- RUN python -c "import whisper; whisper.load_model('tiny', device='cpu'); print('Whisper cached')"
69
-
70
- RUN deno --version && yt-dlp --version && python -c "import numpy; print('numpy', numpy.__version__)"
71
-
72
- EXPOSE 7860
73
- CMD ["./start.sh"]
 
1
  FROM python:3.11-slim
2
 
3
+ # HuggingFace Spaces requires port 7860
4
+ EXPOSE 7860
 
 
 
 
 
 
 
 
5
 
6
  WORKDIR /app
7
 
8
+ # Install dependencies
 
 
 
 
 
 
 
9
  COPY requirements.txt .
10
  RUN pip install --no-cache-dir -r requirements.txt
11
 
12
+ # Copy app files
13
+ COPY . .
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
+ # HuggingFace runs as non-root user (uid 1000)
16
+ # Create writable directory for SQLite DB
17
+ RUN mkdir -p /data && chmod 777 /data
18
 
19
+ # Non-root user
20
+ RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
21
+ USER appuser
 
 
22
 
23
+ CMD ["python", "app.py"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app.py CHANGED
The diff for this file is too large to render. See raw diff
 
requirements.txt CHANGED
@@ -1,18 +1,2 @@
1
- flask==3.1.1
2
- openai>=1.82.0
3
- openai-whisper>=20240930
4
- edge-tts>=6.1.18
5
- google-genai>=1.16.1
6
- huggingface_hub>=0.30.2
7
- yt-dlp[default]>=2025.11.12
8
- yt-dlp-ejs
9
- gunicorn
10
- qrcode[pil]
11
- requests>=2.31.0
12
- feedparser>=6.0.0
13
- tiktok-uploader
14
- playwright
15
- pydub
16
- # ── Telegram Bot (added) ──
17
- python-telegram-bot[job-queue]>=21.0.0
18
- aiofiles>=23.2.1
 
1
+ flask>=2.3.0
2
+ flask-cors>=4.0.0