Ajusta docker

This commit is contained in:
LeoMortari
2025-10-22 12:02:38 -03:00
parent b090f7c2cb
commit c641fd6331
9 changed files with 52 additions and 49 deletions

View File

@@ -4,27 +4,32 @@
# OPENROUTER_MODEL="openai/gpt-oss-20b:free" # OPENROUTER_MODEL="openai/gpt-oss-20b:free"
services: services:
video-render-new: video-render:
restart: unless-stopped restart: unless-stopped
build: . build: .
container_name: video-render-new container_name: video-render
environment: environment:
# RabbitMQ credentials # RabbitMQ credentials
- RABBITMQ_PASS=${RABBITMQ_PASS} # - RABBITMQ_PASS=${RABBITMQ_PASS}
- GEMINI_API_KEY=${GEMINI_API_KEY} - RABBITMQ_PASS="L@l321321321"
# - GEMINI_API_KEY=${GEMINI_API_KEY}
- GEMINI_API_KEY="AIzaSyB5TPjSPPZG1Qb6EtblhKFAjvCOdY15rcw"
- GEMINI_MODEL=${GEMINI_MODEL:-gemini-2.5-pro} - GEMINI_MODEL=${GEMINI_MODEL:-gemini-2.5-pro}
- OPENROUTER_API_KEY=${OPENROUTER_API_KEY} # - OPENROUTER_API_KEY=${OPENROUTER_API_KEY}
- OPENROUTER_API_KEY="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"
- OPENROUTER_MODEL=${OPENROUTER_MODEL:-openai/gpt-oss-20b:free} - OPENROUTER_MODEL=${OPENROUTER_MODEL:-openai/gpt-oss-20b:free}
- FASTER_WHISPER_MODEL_SIZE=${FASTER_WHISPER_MODEL_SIZE:-small} - FASTER_WHISPER_MODEL_SIZE=${FASTER_WHISPER_MODEL_SIZE:-small}
ports: # ports:
- "5000:5000" # - "5000:5000"
volumes: volumes:
# Mount host directories into the container so that videos can be # Mount host directories into the container so that videos can be
# provided and outputs collected. These paths can be customised when # provided and outputs collected. These paths can be customised when
# deploying the stack. The defaults assume /root/videos and # deploying the stack. The defaults assume /root/videos and
# /root/outputs on the host. # /root/outputs on the host.
- "/root/videos:/app/videos" # - "/root/videos:/app/videos"
- "/root/outputs:/app/outputs" # - "/root/outputs:/app/outputs"
- "./videos:/app/videos"
- "./outputs:/app/outputs"
command: "python -u main.py" command: "python -u main.py"
# runtime: nvidia # runtime: nvidia

View File

@@ -1,49 +1,47 @@
FROM python:3.11-slim FROM python:3.11-slim
# Create and set the working directory
WORKDIR /app WORKDIR /app
# Prevent some interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
# Install ffmpeg and other system dependencies. The list largely mirrors
# the original project but omits PostgreSQL development headers which are
# unused here. We include libgl1 and libglib2.0-0 so that MoviePy
# (through its dependencies) can find OpenGL and GLib when using the
# Pillow and numpy backends.
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
ffmpeg \ ffmpeg \
pkg-config \
libavcodec-dev \
libavdevice-dev \
libavfilter-dev \
libavformat-dev \
libavutil-dev \
libswresample-dev \
libswscale-dev \
gcc \
g++ \
libgl1 \ libgl1 \
libglib2.0-0 \ libglib2.0-0 \
build-essential \
xvfb \
xdg-utils \
wget \
unzip \
ffmpeg \
libgomp1 \ libgomp1 \
libpq-dev \ libpq-dev \
vim \
libmagick++-dev \ libmagick++-dev \
imagemagick \ imagemagick \
fonts-liberation \ fonts-liberation \
sox \ sox \
bc \ bc \
gsfonts && \ gsfonts \
xvfb \
xdg-utils \
wget \
unzip \
vim && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
# Copy dependency specification and install Python dependencies
COPY requirements.txt ./ COPY requirements.txt ./
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application code
COPY . . COPY . .
# Declare volumes for videos and outputs. These paths correspond to the
# mount points defined in the docker-compose file. Using VOLUME here
# documents the intended persistent storage locations.
VOLUME ["/app/videos", "/app/outputs"] VOLUME ["/app/videos", "/app/outputs"]
# The default command starts the consumer loop
CMD ["python", "-u", "main.py"] CMD ["python", "-u", "main.py"]

View File

@@ -1,6 +1,6 @@
moviepy==2.2.0 moviepy==2.2.0
pillow==10.3.0 pillow==9.5.0
numpy>=1.26.0 numpy>=1.26.0
requests>=2.31.0 requests
pika>=1.3.2 pika
faster-whisper==1.0.0 faster-whisper==1.2.0

View File

@@ -7,8 +7,8 @@ from typing import Dict, List
import requests import requests
from .config import BASE_DIR, Settings from video_render.config import BASE_DIR, Settings
from .transcription import TranscriptionResult from video_render.transcription import TranscriptionResult
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@@ -5,9 +5,9 @@ import shutil
from dataclasses import dataclass from dataclasses import dataclass
from pathlib import Path from pathlib import Path
from .config import Settings from video_render.config import Settings
from .ffmpeg import extract_audio_to_wav from video_render.ffmpeg import extract_audio_to_wav
from .utils import ensure_workspace, remove_paths, sanitize_filename from video_render.utils import ensure_workspace, remove_paths, sanitize_filename
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@@ -6,7 +6,7 @@ from typing import Any, Callable, Dict
import pika import pika
from .config import Settings from video_render.config import Settings
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@@ -5,12 +5,12 @@ from dataclasses import dataclass, field
from pathlib import Path from pathlib import Path
from typing import Any, Dict, List, Optional from typing import Any, Dict, List, Optional
from .config import Settings from video_render.config import Settings
from .llm import GeminiHighlighter, OpenRouterCopywriter from video_render.llm import GeminiHighlighter, OpenRouterCopywriter
from .media import MediaPreparer, VideoWorkspace from video_render.media import MediaPreparer, VideoWorkspace
from .transcription import TranscriptionResult, TranscriptionService from video_render.transcription import TranscriptionResult, TranscriptionService
from .utils import remove_paths, sanitize_filename from video_render.utils import remove_paths, sanitize_filename
from .rendering import VideoRenderer from video_render.rendering import VideoRenderer
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@@ -16,8 +16,8 @@ from moviepy.editor import (
) )
from PIL import Image, ImageColor, ImageDraw, ImageFont from PIL import Image, ImageColor, ImageDraw, ImageFont
from .config import Settings from video_render.config import Settings
from .transcription import TranscriptionResult, WordTiming from video_render.transcription import TranscriptionResult, WordTiming
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@@ -8,7 +8,7 @@ from typing import List, Optional
from faster_whisper import WhisperModel from faster_whisper import WhisperModel
from .config import Settings from video_render.config import Settings
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)