Files
nr-flow-validator/infra/librespot/Dockerfile
T
david 32b9189f2f librespot: add native-tls feature (required by librespot-oauth)
oauth2 crate gates TLS backends behind features; without native-tls,
librespot-oauth fails to compile with compile_error!. The default
features include native-tls, but we use --no-default-features for
minimal build.
2026-07-01 05:52:07 -07:00

44 lines
1.3 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.
RUN cargo build --release --jobs 2 \
--no-default-features \
--features="pulseaudio-backend,native-tls"
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", \
"--enable-audio-cache", \
"--cache", "/var/cache/librespot"]