From 0570852cac58d910a4226ac7ba5adf02528838f3 Mon Sep 17 00:00:00 2001 From: XShine555 Date: Mon, 20 Jul 2026 07:27:51 +0200 Subject: [PATCH] feat(worker): install yt-dlp and deno in the worker image yt-dlp goes through pip in a venv rather than the standalone PyInstaller binary, which unpacks on every invocation and roughly doubles latency. deno solves the nsig challenges. --- backend/Musify.Worker.Dockerfile | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/backend/Musify.Worker.Dockerfile b/backend/Musify.Worker.Dockerfile index b65f627..15ab9fc 100644 --- a/backend/Musify.Worker.Dockerfile +++ b/backend/Musify.Worker.Dockerfile @@ -17,9 +17,18 @@ RUN cp /app/AppSettings.json /app/appsettings.json \ FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime WORKDIR /app -# ffmpeg: the Worker transcodes audio to .m4a. +# ffmpeg: the Worker transcodes audio to .m4a. yt-dlp: downloads YouTube audio. +# yt-dlp is installed via pip in a venv rather than the standalone PyInstaller +# binary: the binary adds a ~1s unpack cost per invocation and extracts slower, +# so pip roughly halves resolution latency. deno solves nsig challenges. 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 ffmpeg python3 python3-venv ca-certificates curl unzip \ + && python3 -m venv /opt/ytdlp \ + && /opt/ytdlp/bin/pip install --no-cache-dir -U yt-dlp \ + && ln -s /opt/ytdlp/bin/yt-dlp /usr/local/bin/yt-dlp \ + && curl -fsSL https://deno.land/install.sh | sh -s -- -y \ + && mv /root/.deno/bin/deno /usr/local/bin/deno \ + && apt-get purge -y curl unzip \ + && rm -rf /var/lib/apt/lists/* /root/.deno COPY --from=build /app ./ ENTRYPOINT ["dotnet", "Musify.Worker.dll"]