Files
nr-flow-validator/infra/librespot/Dockerfile
T
david e2e9492a8d librespot: add with-libmdns feature for Spotify Connect discovery
Without zeroconf backend, librespot fails with 'Credentials are required
if discovery and oauth login are disabled'. The default features include
with-libmdns but our --no-default-features build excluded it.

Add with-libmdns so the device advertises itself via mDNS and shows up
in phone Spotify apps as a Connect target.
2026-07-01 07:38:40 -07:00

46 lines
1.4 KiB
Docker

# Librespot (Spotify Connect) for ARM64
# Multi-stage Docker build. Run on ARM64 host (RPi 3B+ etc).
# Audio output: PulseAudio (connects to audio-bridge via TCP localhost:4713).
FROM rust:1.85.1-bookworm AS builder
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libpulse-dev \
libasound2-dev \
&& rm -rf /var/lib/apt/lists/*
ARG LIBRESPOT_VERSION=v0.8.0
RUN git clone --depth 1 --branch ${LIBRESPOT_VERSION} \
https://github.com/librespot-org/librespot.git /src
WORKDIR /src
# Limit parallelism to 2 (RPi 3B+ has 4 cores but only 1GB RAM).
# Lower = less memory pressure, slower build. Higher = OOM risk.
# Features: pulseaudio (audio out) + native-tls (TLS) + with-libmdns (Spotify Connect
# discovery via mDNS — required for the device to appear in phone Spotify apps).
RUN cargo build --release --jobs 2 \
--no-default-features \
--features="pulseaudio-backend,native-tls,with-libmdns"
FROM debian:bookworm-slim
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
libpulse0 \
libasound2 \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /src/target/release/librespot /usr/local/bin/librespot
VOLUME ["/var/cache/librespot"]
ENV PULSE_SERVER=tcp:127.0.0.1:4713
CMD ["librespot", \
"--name", "Klubhaus", \
"--backend", "pulseaudio", \
"--bitrate", "320", \
"--initial-volume", "100", \
"--cache", "/var/cache/librespot"]