Erweiterter sed-Patch der oauth/src/lib.rs: - '127.0.0.1' (String-Literal) - [127, 0, 0, 1] (Array-Syntax) - Ipv4Addr::LOCALHOST (Rust-Konstante → Ipv4Addr::UNSPECIFIED) Build gibt die gepatchten Zeilen aus damit der Patch nachvollziehbar ist. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
72 lines
2.4 KiB
Docker
72 lines
2.4 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 localhost).
|
|
# Rust-Code kann die Adresse auf verschiedene Weisen schreiben:
|
|
sed -i \
|
|
-e 's/127\.0\.0\.1/0.0.0.0/g' \
|
|
-e 's/\[127, 0, 0, 1\]/[0, 0, 0, 0]/g' \
|
|
-e 's/Ipv4Addr::LOCALHOST/Ipv4Addr::UNSPECIFIED/g' \
|
|
oauth/src/lib.rs && \
|
|
echo "--- oauth/src/lib.rs (Addr-Zeilen nach Patch) ---" && \
|
|
grep -n "0\.0\.0\|UNSPECIFIED\|127\|LOCALHOST" oauth/src/lib.rs || true && \
|
|
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"]
|