YouTube's bot checks block yt-dlp from fetching audio on the server, so suggested songs now play in YouTube's embedded player, kept out of sight, in the browser. yt-dlp is only used to search. - GET /api/discover/youtube/<id> returns candidate video IDs, best first, or the one that played before (?refresh=true searches again). - PUT /api/discover/youtube/<id> remembers the video that played. - The UI tries the next candidate when a video can't be embedded, searches again when a remembered video is gone, and skips the song otherwise. - Drop the YouTube audio proxy, and Deno from the image. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
47 lines
1.5 KiB
Docker
47 lines
1.5 KiB
Docker
# Image for running playlistd, used by compose.yaml. (Containerfile is for building the .deb.)
|
|
|
|
# ---- web UI ----
|
|
FROM node:22.23.4-bookworm-slim AS ui
|
|
WORKDIR /src
|
|
COPY discover/package.json discover/package-lock.json ./
|
|
RUN npm ci
|
|
COPY discover/ ./
|
|
RUN npm run build
|
|
|
|
# ---- server ----
|
|
FROM rust:1.97-bookworm AS server
|
|
WORKDIR /src
|
|
COPY Cargo.toml Cargo.lock ./
|
|
COPY .sqlx .sqlx
|
|
COPY migrations migrations
|
|
COPY src src
|
|
# check SQL queries against .sqlx (made by `cargo sqlx prepare`) rather than a live database
|
|
ENV SQLX_OFFLINE=true
|
|
RUN cargo build --release --locked
|
|
|
|
# ---- runtime ----
|
|
FROM debian:bookworm-slim
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends ca-certificates libssl3 python3 python3-venv \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# yt-dlp finds suggested songs on YouTube. It has to be recent to keep working with YouTube, so
|
|
# the latest version is installed: rebuild the image to update it, or set YTDLP_VERSION to pin one.
|
|
ARG YTDLP_VERSION=
|
|
RUN python3 -m venv /opt/yt-dlp \
|
|
&& /opt/yt-dlp/bin/pip install --no-cache-dir "yt-dlp[default]${YTDLP_VERSION:+==${YTDLP_VERSION}}" \
|
|
&& ln -s /opt/yt-dlp/bin/yt-dlp /usr/local/bin/yt-dlp
|
|
|
|
COPY --from=server /src/target/release/playlistd /usr/local/bin/playlistd
|
|
COPY --from=ui /src/dist /usr/share/playlistd/discover
|
|
|
|
RUN useradd --system --create-home --home-dir /var/lib/playlistd playlistd
|
|
USER playlistd
|
|
WORKDIR /var/lib/playlistd
|
|
|
|
ENV ROCKET_ADDRESS=0.0.0.0 \
|
|
ROCKET_PORT=8000 \
|
|
DISCOVER_UI=/usr/share/playlistd/discover
|
|
EXPOSE 8000
|
|
CMD ["playlistd"]
|