File size: 1,689 Bytes
851e5ba | 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 51 52 53 54 55 56 57 58 59 60 | # Use Python 3.11 slim image
FROM python:3.11.17-slim-trixie
# Install system dependencies including ffmpeg and unzip (for deno).
# Noto provides fallback glyphs for multilingual captions (including Hindi)
# and colour emoji. libass/fontconfig selects them when a chosen font lacks glyphs.
RUN apt-get update && apt-get install -y \
ffmpeg \
tesseract-ocr \
tesseract-ocr-eng \
curl \
unzip \
fonts-noto-core \
fonts-noto-cjk \
fonts-noto-color-emoji \
fontconfig \
&& fc-cache -f \
&& rm -rf /var/lib/apt/lists/*
# Install deno (required by yt-dlp for YouTube JS challenge solving)
RUN curl -fsSL https://deno.land/install.sh | sh
ENV DENO_DIR=/root/.deno
ENV PATH="/root/.deno/bin:${PATH}"
# Install uv package manager
RUN pip install uv
# Set working directory
WORKDIR /app
# Copy pyproject.toml and uv.lock for dependency installation
COPY pyproject.toml uv.lock* ./
# New self-hosted setups can select CPU wheels without changing legacy builds.
ARG BACKEND_CPU_ONLY=false
RUN uv venv .venv && \
if [ "$BACKEND_CPU_ONLY" = "true" ]; then \
uv sync --frozen --extra cpu; \
else \
uv sync --frozen --extra cuda; \
fi
# yt-dlp and its PO-token plugin are installed from uv.lock above.
# Copy source code
COPY src/ ./src/
# Copy fonts and transitions directories
COPY fonts/ ./fonts/
COPY transitions/ ./transitions/
# Create necessary directories for video processing
RUN mkdir -p /app/uploads /app/clips /app/logs /tmp
# Expose the port FastAPI will run on
EXPOSE 8000
# Activate virtual environment and start the application
CMD [".venv/bin/uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "8000"]
|