Files
Busch-Radio-Spotify/busch_radio_spotify/Dockerfile
retr0 2fb79dcead Release v1.0.5: OAuth-Server auf 0.0.0.0 gepatcht
librespot bindet den OAuth-Callback-Server an 127.0.0.1 (nur lokal
erreichbar). Das macht den OAuth-Flow von Heimnetz-Geräten unmöglich.

Fix: librespot Quellcode wird geklont, oauth/src/lib.rs gepatcht
(127.0.0.1 → 0.0.0.0), und dann mit cargo build kompiliert.
Damit ist http://<ha-ip>:5588 aus dem Browser im Heimnetz erreichbar.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 18:54:57 +02:00

65 lines
2.0 KiB
Docker

ARG BUILD_FROM
# ============================================================
# Build stage: Librespot aus Rust-Quellcode kompilieren
# ============================================================
FROM rust:alpine AS librespot-builder
RUN apk add --no-cache \
musl-dev \
pkgconfig \
openssl-dev \
openssl-libs-static \
git
# Librespot aus dem Git-Tag klonen, patchen und kompilieren.
#
# Patch: OAuth-Server bindet an 0.0.0.0 statt 127.0.0.1.
# Standard: 127.0.0.1 → nur vom HA-Host selbst erreichbar.
# Mit 0.0.0.0 → der OAuth-Flow ist im Browser aus dem Heimnetz zugänglich.
#
# --locked: verwendet das originale Cargo.lock aus dem Tag (pinnt vergen-gitcl
# auf 0.x und vermeidet so den vergen_lib Versionskonflikt mit 9.x).
RUN git clone --depth 1 --branch v0.7.0 \
https://github.com/librespot-org/librespot.git /build && \
cd /build && \
# OAuth-Server auf allen Interfaces binden (statt nur 127.0.0.1)
sed -i 's/127\.0\.0\.1/0.0.0.0/g' oauth/src/lib.rs && \
cargo build \
--release \
--locked \
--no-default-features \
--features "native-tls" && \
mkdir -p /install/bin && \
cp target/release/librespot /install/bin/librespot
# ============================================================
# Runtime stage: HA-Basis-Image + ffmpeg + icecast
# ============================================================
FROM ${BUILD_FROM}
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Abhängigkeiten installieren
# icecast liegt in Alpine's Community-Repository
RUN apk add --no-cache \
bash \
jq \
curl \
python3 \
ffmpeg \
&& apk add --no-cache \
--repository=https://dl-cdn.alpinelinux.org/alpine/edge/community \
icecast \
|| apk add --no-cache icecast
# Librespot-Binary aus dem Build-Stage übernehmen
COPY --from=librespot-builder /install/bin/librespot /usr/local/bin/librespot
RUN chmod +x /usr/local/bin/librespot
# Add-on Dateien kopieren
COPY run.sh /run.sh
RUN chmod a+x /run.sh
CMD ["/run.sh"]