-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (31 loc) · 1.68 KB
/
Dockerfile
File metadata and controls
36 lines (31 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
FROM rust:trixie AS builder
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y build-essential libasound2-dev libpulse-dev git libssl-dev pkg-config
WORKDIR /src
RUN git clone https://github.com/librespot-org/librespot.git librespot
WORKDIR /src/librespot
ARG VERSION="666"
RUN git pull --rebase # Make sure we have the latest changes; do this after ARG is declared so we bust cacheing
RUN git status || true
# Now bake the build version into package.version in Cargo.toml and Cargo.lock
RUN <<HEREDOC
# Grab the current version from Cargo.toml
upstream_version=$(grep '^version = ' Cargo.toml | head -n1 | sed -e 's/version = "//' -e 's/"//')
if [ -z "$upstream_version" ]; then
echo "FATAL: Could not determine upstream version from Cargo.toml"
exit 1
fi
echo "--> Upstream version: $upstream_version"
# Now, build our new version string, appending the build number
new_version="${upstream_version}-build-${VERSION}"
# Replace all occurences of the version in Cargo.toml and Cargo.lock with the new_version
sed -i "s/version = \"${upstream_version}\"/version = \"${new_version}\"/g" Cargo.lock $(find . -name Cargo.toml)
HEREDOC
RUN git diff
RUN cargo build --release --no-default-features --features pulseaudio-backend,with-libmdns,native-tls
FROM debian:trixie-slim
RUN apt-get update && apt-get install -y libpulse0 ca-certificates pamixer && rm -rf /var/lib/apt/lists/* && apt-get clean
COPY --from=builder /src/librespot/target/release/librespot /usr/local/bin/librespot
RUN /usr/local/bin/librespot --version
RUN /usr/local/bin/librespot --help
CMD ["/usr/local/bin/librespot", "--bitrate", "320", "--name", "librespot", "--device-type", "speaker", "--backend", "pulseaudio"]