e5b52fa56f
Cross-compile on x86_64 with qemu emulation takes >30min and hits 60-90min ceiling due to slow crate-by-crate aarch64 build under qemu. Native ARM64 build on RPi 3B+ with --jobs 2 (1GB RAM) is much faster. Rust 1.85.1 installed via rustup on RPi (precompiled aarch64 toolchain).
44 lines
1.2 KiB
Docker
44 lines
1.2 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"
|
|
|
|
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"]
|