File size: 1,197 Bytes
8579006
 
 
 
 
 
 
 
 
 
 
 
 
76a359a
 
7e64651
76a359a
8579006
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.10-slim

# System dependencies for FFmpeg, OpenCV, MediaPipe, DNS debugging
RUN apt-get update && apt-get install -y --no-install-recommends \
    ffmpeg \
    libgl1 \
    libglib2.0-0 \
    libsm6 \
    libxext6 \
    libxrender1 \
    git \
    dnsutils \
    curl \
    python3-dev \
    python3-pip \
    nodejs \
    npm \
    && rm -rf /var/lib/apt/lists/*

# Create non-root user (HF Spaces requirement)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

WORKDIR /home/user/app

# Install Python dependencies
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
    pip install --no-cache-dir --no-build-isolation openai-whisper==20240930 && \
    pip install --no-cache-dir -r requirements.txt && \
    pip install --no-cache-dir -U yt-dlp

# Copy application files
COPY --chown=user . .

# Create writable directories for clips and downloads
RUN mkdir -p clips downloads

# Create empty cookies.txt if not provided (user can upload their own)
RUN test -f cookies.txt || touch cookies.txt

# HF Spaces expects port 7860
ENV PORT=7860
EXPOSE 7860

CMD ["python", "server.py"]