Add deno and weekly yt-dlp refresh to the image
Install deno in the runtime stage and yt-dlp[default] (which brings yt-dlp-ejs) so YouTube JS challenges can be solved. Replace the --upgrade layer with a YTDLP_REFRESH build arg, and add a weekly scheduled CI build that passes the date and --pull.
This commit is contained in:
1 parent
e1beb5f12b
commit
41e809c9dc
2 files changed
+23
-7
No files matched your search
+14
-3
@@ -1,6 +1,13 @@
|
||||
name: CI
|
||||
|
||||
on: [push, pull_request]
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
schedule:
|
||||
# Weekly image refresh for yt-dlp and the base images. Gitea reads cron in
|
||||
# UTC: Saturday 23:00 EDT / 22:00 EST on mainframe, ahead of
|
||||
# podman-stack-update.timer pulling :latest at Sunday 04:00 local.
|
||||
- cron: '0 3 * * 0'
|
||||
|
||||
jobs:
|
||||
check:
|
||||
@@ -30,7 +37,7 @@ jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
needs: check
|
||||
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
||||
if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'schedule')
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
@@ -46,6 +53,10 @@ jobs:
|
||||
|
||||
- name: Build and push
|
||||
run: |
|
||||
docker build -t git.rcjohnstone.com/connor/shanty:latest -t git.rcjohnstone.com/connor/shanty:${{ github.sha }} .
|
||||
extra_args=""
|
||||
if [ "${{ github.event_name }}" = "schedule" ]; then
|
||||
extra_args="--pull --build-arg YTDLP_REFRESH=$(date -u +%Y-%m-%d)"
|
||||
fi
|
||||
docker build $extra_args -t git.rcjohnstone.com/connor/shanty:latest -t git.rcjohnstone.com/connor/shanty:${{ github.sha }} .
|
||||
docker push git.rcjohnstone.com/connor/shanty:latest
|
||||
docker push git.rcjohnstone.com/connor/shanty:${{ github.sha }}
|
||||
+9
-4
@@ -21,11 +21,16 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
firefox-esr xvfb x11vnc novnc websockify sqlite3 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN python3 -m venv /opt/venv \
|
||||
&& /opt/venv/bin/pip install --no-cache-dir ytmusicapi yt-dlp
|
||||
# yt-dlp needs a JavaScript runtime to solve YouTube's challenges
|
||||
COPY --from=denoland/deno:bin-2.9.7 /deno /usr/local/bin/deno
|
||||
|
||||
# Changing YTDLP_REFRESH (the scheduled CI build passes the date) rebuilds
|
||||
# this layer so yt-dlp is reinstalled at its latest release
|
||||
ARG YTDLP_REFRESH=none
|
||||
RUN echo "yt-dlp refresh: ${YTDLP_REFRESH}" \
|
||||
&& python3 -m venv /opt/venv \
|
||||
&& /opt/venv/bin/pip install --no-cache-dir ytmusicapi "yt-dlp[default]"
|
||||
ENV PATH="/opt/venv/bin:$PATH"
|
||||
# Ensure absolute latest yt-dlp (pip cache may lag behind releases)
|
||||
RUN /opt/venv/bin/pip install --no-cache-dir --upgrade yt-dlp
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
|
||||
Reference in new issue
Block a user