File size: 1,954 Bytes
07e8c38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7603a3a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
FROM python:3.12-slim

WORKDIR /app

RUN echo "[BUILD] step1: apt-get update+install ffmpeg + Vietnamese fonts" && \
    apt-get update && apt-get install -y --no-install-recommends \
        ffmpeg \
        fonts-dejavu-core \
        fonts-noto \
        fonts-noto-cjk \
        fonts-noto-color-emoji \
        fonts-liberation \
        fonts-freefont-ttf \
        libfreetype6 \
        && rm -rf /var/lib/apt/lists/* && \
    echo "[BUILD] step1 done"

RUN echo "[BUILD] step2: pip base pkgs (bs4/lxml)" && \
    pip install --no-cache-dir "beautifulsoup4>=4.12" lxml && \
    echo "[BUILD] step2 done"

RUN echo "[BUILD] step3: pip main pkgs" && \
    pip install --no-cache-dir fastapi uvicorn requests beautifulsoup4 jinja2 yt-dlp huggingface_hub gTTS pillow edge-tts python-dateutil httpx pycryptodome && \
    echo "[BUILD] step3 done"

COPY requirements.txt .
RUN echo "[BUILD] step4: pip requirements.txt" && \
    pip install --no-cache-dir -r requirements.txt || true && \
    echo "[BUILD] step4 done"

COPY . .
EXPOSE 7860

RUN echo "[BUILD] step5: setup Vietnamese font symlink" && \
    mkdir -p /usr/share/fonts/truetype/vn && \
    # Prefer Noto Sans for Vietnamese - it has full diacritic support
    if [ -f /usr/share/fonts/truetype/noto/NotoSans-Regular.ttf ]; then \
        ln -sf /usr/share/fonts/truetype/noto/NotoSans-Regular.ttf /usr/share/fonts/truetype/vn/VNFont.ttf; \
    elif [ -f /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf ]; then \
        ln -sf /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf /usr/share/fonts/truetype/vn/VNFont.ttf; \
        ln -sf /usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf /usr/share/fonts/truetype/vn/VNFont-Bold.ttf; \
    fi; \
    fc-cache -f -v || true; \
    date > /app/.build_done && \
    echo "[BUILD] step5 done"

CMD ["uvicorn", "_run:app", "--host", "0.0.0.0", "--port", "7860"]
# v3.0-vn-font-fix-short-video-2026-07-19
# rebuild-trigger: m3u-perf-fix-20260829