From 246894e7e33418ea67216b6b1ac593411eb1a502 Mon Sep 17 00:00:00 2001 From: LeoMortari Date: Sun, 28 Sep 2025 20:07:05 -0300 Subject: [PATCH] Ajustes no compose e no dockerfile --- docker-compose.yml | 4 ++++ dockerfile | 34 ++++++++++++++++++++++++++-------- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index beb8eb1..bb5868c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,10 +4,14 @@ services: context: . dockerfile: dockerfile container_name: youtube-api + dns: [8.8.8.8, 1.1.1.1] + sysctls: + - net.ipv6.conf.all.disable_ipv6=1 ports: - "3011:8000" volumes: - /root/videos:/app/videos + # - ./videos:/app/videos environment: - PYTHONUNBUFFERED=1 networks: diff --git a/dockerfile b/dockerfile index cdc3b79..47f601b 100644 --- a/dockerfile +++ b/dockerfile @@ -1,19 +1,37 @@ -FROM python:3.10-slim +FROM python:3.10-slim-bookworm -ENV PYTHONDONTWRITEBYTECODE=1 -ENV PYTHONUNBUFFERED=1 +ENV PYTHONDONTWRITEBYTECODE=1 \ + PYTHONUNBUFFERED=1 \ + PIP_NO_CACHE_DIR=1 \ + TZ=America/Sao_Paulo \ + LANG=C.UTF-8 \ + LC_ALL=C.UTF-8 WORKDIR /app RUN apt-get update && \ - apt-get install -y --no-install-recommends ffmpeg && \ - rm -rf /var/lib/apt/lists/* + apt-get install -y --no-install-recommends \ + ca-certificates tzdata ffmpeg curl iputils-ping dnsutils procps \ + && update-ca-certificates \ + && rm -rf /var/lib/apt/lists/* -COPY requirements.txt . -RUN pip install --no-cache-dir -r requirements.txt +COPY requirements.txt /app/requirements.txt + +RUN python -m pip install --upgrade pip setuptools wheel && \ + pip install -r /app/requirements.txt && \ + pip install brotli brotlicffi mutagen certifi` + +RUN printf "%s\n" \ + "--force-ipv4" \ + "--noplaylist" \ + "--merge-output-format" "mp4" \ + "--extractor-args" "youtube:player_client=android,player_skip=webpage" \ + "--format" "bv*+ba/b[height<=1080]/b" \ + > /etc/yt-dlp.conf COPY . . -EXPOSE 8000 +RUN mkdir -p /app/videos && chmod 777 /app/videos +EXPOSE 8000 CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]