Dockerfile 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # Cross compilation environment for librespot
  2. # Build the docker image from the root of the project with the following command :
  3. # $ docker build -t librespot-cross -f contrib/Dockerfile .
  4. #
  5. # The resulting image can be used to build librespot for linux x86_64, armhf and armel.
  6. # $ docker run -v /tmp/librespot-build:/build librespot-cross
  7. #
  8. # The compiled binaries will be located in /tmp/librespot-build
  9. #
  10. # If only one architecture is desired, cargo can be invoked directly with the appropriate options :
  11. # $ docker run -v /tmp/librespot-build:/build librespot-cross cargo build --release --no-default-features --features "with-syntex alsa-backend"
  12. # $ docker run -v /tmp/librespot-build:/build librespot-cross cargo build --release --target arm-unknown-linux-gnueabihf --no-default-features --features "with-syntex alsa-backend"
  13. # $ docker run -v /tmp/librespot-build:/build librespot-cross cargo build --release --target arm-unknown-linux-gnueabi --no-default-features --features "with-syntex alsa-backend"
  14. #
  15. FROM debian:stretch
  16. RUN dpkg --add-architecture armhf
  17. RUN dpkg --add-architecture armel
  18. RUN apt-get update
  19. RUN apt-get install -y curl build-essential crossbuild-essential-armhf crossbuild-essential-armel
  20. RUN apt-get install -y libasound2-dev libasound2-dev:armhf libasound2-dev:armel
  21. RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
  22. ENV PATH="/root/.cargo/bin/:${PATH}"
  23. RUN rustup target add arm-unknown-linux-gnueabi
  24. RUN rustup target add arm-unknown-linux-gnueabihf
  25. RUN echo '[target.arm-unknown-linux-gnueabihf]\nlinker = "arm-linux-gnueabihf-gcc"' > ~/.cargo/config
  26. RUN echo '[target.arm-unknown-linux-gnueabi]\nlinker = "arm-linux-gnueabi-gcc"' > ~/.cargo/config
  27. RUN mkdir /build
  28. ENV CARGO_TARGET_DIR /build
  29. ADD . /src
  30. WORKDIR /src
  31. CMD ["/src/contrib/docker-build.sh"]