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 # Librespot ohne Hardware-Audio-Backends kompilieren. # --no-default-features entfernt ALSA/PulseAudio; der Pipe-Backend # ist immer verfügbar und reicht für diesen Anwendungsfall. RUN cargo install librespot \ --no-default-features \ --root /install # ============================================================ # 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"]