Files
stoat-mbot/Dockerfile
T
Leonid PershinandClaude Opus 5 315760e076 Update bundled yt-dlp and report source failures in chat
The image shipped a year-old yt-dlp, which YouTube now rejects with
"The page needs to be reloaded". Bumped to 2026.08.19 and documented
rebuilding as the standard fix, including how to pass a newer tag
without waiting for a repository update.

A downloader dying mid-stream also looked exactly like a very short
track: ffmpeg saw EOF, the player advanced, and the channel only got
"queue finished". The failure reason now reaches the chat.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-08 23:45:25 +03:00

52 lines
1.9 KiB
Docker

# --- panel bundle -----------------------------------------------------------
FROM node:22-bookworm-slim AS web
WORKDIR /app/web
COPY web/package.json web/package-lock.json* ./
RUN npm install --no-audit --no-fund
COPY web/ ./
RUN npm run build
# --- server dependencies ----------------------------------------------------
# glibc image on purpose: @livekit/rtc-node ships prebuilt glibc binaries.
FROM node:22-bookworm-slim AS deps
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm install --omit=dev --no-audit --no-fund
FROM node:22-bookworm-slim AS build
WORKDIR /app
COPY package.json package-lock.json* tsconfig.json ./
RUN npm install --no-audit --no-fund
COPY src/ ./src/
RUN npm run build
# --- runtime ----------------------------------------------------------------
FROM node:22-bookworm-slim AS runtime
ENV NODE_ENV=production
# yt-dlp keeps its cache under $HOME; /app is not writable for the node user.
ENV HOME=/tmp
WORKDIR /app
# yt-dlp_linux is a self-contained binary, so no Python runtime is needed.
# YouTube breaks extractors regularly, so keep this current: rebuilding with
# --build-arg YTDLP_VERSION=<tag> (or bumping this default) is the usual fix for
# "The page needs to be reloaded" and similar extraction errors.
ARG YTDLP_VERSION=2026.08.19
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates curl \
&& curl -fsSL "https://github.com/yt-dlp/yt-dlp/releases/download/${YTDLP_VERSION}/yt-dlp_linux" -o /usr/local/bin/yt-dlp \
&& chmod +x /usr/local/bin/yt-dlp \
&& yt-dlp --version \
&& apt-get purge -y curl \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
COPY --from=deps /app/node_modules ./node_modules
COPY --from=build /app/dist ./dist
COPY --from=web /app/web/dist ./web/dist
COPY package.json ./
USER node
EXPOSE 3005
CMD ["node", "dist/index.js"]