cargo install von crates.io löst immer die neuesten Abhängigkeiten auf und zieht vergen-gitcl >=1.0 rein (vergen-lib 9.x), was mit dem build.rs von librespot-core kollidiert (erwartet vergen-lib 0.1.x). Mit --git --tag v0.7.0 --locked wird das originale Cargo.lock aus dem Release-Tag verwendet, das vergen-gitcl 0.x pinnt. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
61 lines
1.8 KiB
Docker
61 lines
1.8 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 mit --locked kompilieren.
|
|
#
|
|
# Hintergrund: `cargo install librespot --version X.Y.Z` (ohne --locked) löst
|
|
# immer die NEUESTEN kompatiblen Abhängigkeiten auf. Das zieht vergen-gitcl
|
|
# >= 1.0 rein, das vergen-lib 9.x benötigt. librespot-core's build.rs erwartet
|
|
# jedoch vergen-lib 0.1.x → Versionkonflikt → Build-Fehler E0277.
|
|
#
|
|
# Mit `--git --tag --locked` verwendet cargo das originale Cargo.lock aus dem
|
|
# Release-Tag, das vergen-gitcl 0.x pinnt und damit kompatibel ist.
|
|
RUN cargo install \
|
|
--git https://github.com/librespot-org/librespot \
|
|
--tag v0.7.0 \
|
|
--locked \
|
|
--no-default-features \
|
|
--root /install \
|
|
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"]
|