Dockerfile.Rpi 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # Create a docker image for the RPI
  2. # Build the docker image from the root of the project with the following command :
  3. # $ docker build -t librespot-rpi -f .\contrib\Dockerfile.Rpi .
  4. #
  5. # This builds a docker image which is usable when running docker on the rpi.
  6. #
  7. # This Dockerfile builds in windows without any requirements, for linux based systems you might need to run the following line:
  8. # docker run --rm --privileged multiarch/qemu-user-static:register --reset
  9. # (see here for more info: https://gist.github.com/PieterScheffers/d50f609d9628383e4c9d8d7d269b7643 )
  10. #
  11. # Save the docker image to a file:
  12. # $ docker save -o contrib/librespot-rpi librespot-rpi
  13. #
  14. # Move it to the rpi and import it with:
  15. # docker load -i librespot-rpi
  16. #
  17. # Run it with:
  18. # docker run -d --restart unless-stopped $(for DEV in $(find /dev/snd -type c); do echo --device=$DEV:$DEV; done) --net=host --name librespot-rpi librespot-rpi --name {devicename}
  19. FROM debian:stretch
  20. RUN dpkg --add-architecture armhf
  21. RUN apt-get update
  22. RUN apt-get install -y curl git build-essential crossbuild-essential-armhf
  23. RUN apt-get install -y libasound2-dev libasound2-dev:armhf
  24. RUN apt-get install -y pkg-config
  25. RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
  26. ENV PATH="/root/.cargo/bin/:${PATH}"
  27. RUN rustup target add arm-unknown-linux-gnueabihf
  28. RUN mkdir /.cargo && \
  29. echo '[target.arm-unknown-linux-gnueabihf]\nlinker = "arm-linux-gnueabihf-gcc"' >> /.cargo/config
  30. RUN mkdir /build
  31. ENV CARGO_TARGET_DIR /build
  32. ENV CARGO_HOME /build/cache
  33. ENV PKG_CONFIG_PATH /usr/lib/arm-linux-gnueabihf/pkgconfig/
  34. ENV PKG_CONFIG_ALLOW_CROSS 1
  35. RUN apt-get install -y libpulse-dev:armhf libjack-dev:armhf
  36. ADD . /src
  37. WORKDIR /src
  38. RUN cargo build --release --target arm-unknown-linux-gnueabihf --no-default-features --features "alsa-backend,pulseaudio-backend,jackaudio-backend"
  39. FROM resin/rpi-raspbian
  40. RUN apt-get update && \
  41. apt-get install libasound2 && \
  42. rm -rf /var/lib/apt/lists/*
  43. RUN mkdir /librespot
  44. WORKDIR /librespot
  45. COPY --from=0 /build/arm-unknown-linux-gnueabihf/release/librespot .
  46. RUN chmod +x librespot
  47. ENTRYPOINT ["./librespot"]