From 019d92fbe49a6c127206bf560f38a38882e9de7f Mon Sep 17 00:00:00 2001 From: Arsen Shkrumelyak Date: Wed, 5 Feb 2025 14:43:41 +0000 Subject: [PATCH] i wonder if this will work --- youtube-dl/Dockerfile | 10 ++++++++-- youtube-dl/entrypoint.sh | 3 +++ youtube-dl/yt-dlp.sh | 10 ++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100755 youtube-dl/entrypoint.sh create mode 100755 youtube-dl/yt-dlp.sh diff --git a/youtube-dl/Dockerfile b/youtube-dl/Dockerfile index 4658a1f..7bbcc80 100644 --- a/youtube-dl/Dockerfile +++ b/youtube-dl/Dockerfile @@ -14,6 +14,8 @@ RUN apt-get update && apt-get install -y \ # Copy project files COPY pyproject.toml . COPY uv.lock . +COPY yt-dlp.sh . +COPY entrypoint.sh /entrypoint.sh # uv stuff RUN . "${HOME}/.local/bin/env" \ @@ -21,7 +23,11 @@ RUN . "${HOME}/.local/bin/env" \ && . .venv/bin/activate \ && uv pip install -e . \ # Install yt-dlp - && uv pip install -U --pre yt-dlp + && uv pip install -U --pre yt-dlp \ + # Create update script + && chmod +x /entrypoint.sh \ + && chmod +x /app/yt-dlp.sh \ + && echo '*/10 * * * * /app/yt-dlp.sh' | crontab - # Copy application code COPY . . @@ -41,4 +47,4 @@ ENV YOUTUBEDL_DEBUG=false \ PATH="/app/.venv/bin:${PATH}" # Run the app using the Python from the virtual environment -CMD ["/app/.venv/bin/python", "src/main.py"] +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/youtube-dl/entrypoint.sh b/youtube-dl/entrypoint.sh new file mode 100755 index 0000000..41c0316 --- /dev/null +++ b/youtube-dl/entrypoint.sh @@ -0,0 +1,3 @@ +#!/bin/bash +service cron start +exec /app/.venv/bin/python src/main.py diff --git a/youtube-dl/yt-dlp.sh b/youtube-dl/yt-dlp.sh new file mode 100755 index 0000000..792be36 --- /dev/null +++ b/youtube-dl/yt-dlp.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# Activate the virtual environment +. /app/.venv/bin/activate + +# Install the package +uv pip install -e . + +# Upgrade yt-dlp +uv pip install -U --pre yt-dlp \ No newline at end of file