forked from mdirkse/rust_armv6
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (32 loc) · 1.52 KB
/
Dockerfile
File metadata and controls
36 lines (32 loc) · 1.52 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 rustlang/rust:nightly
# Prevent any error messages about there not being a terminal
ENV DEBIAN_FRONTEND noninteractive
# Allow pkg-config to find
ENV PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig
# RPI tools dir
ENV RPI_TOOLS=/rpi_tools
ENV PKG_CONFIG_ALLOW_CROSS=1
# Enable the armhf arch
RUN dpkg --add-architecture armhf
RUN apt-get update -qq && \
# Install the necessary packages
# libudev-dev will also bring in the arm libc6 and gcc packages
apt-get install -qq --no-install-recommends cmake git pkg-config libudev-dev:armhf && \
# Add the RPI toolchain
git -C "/" clone -q --depth=1 https://github.com/raspberrypi/tools.git "${RPI_TOOLS}" && \
# Remove most of the repo we just downloaded as we only need a small amount
rm -fr "${RPI_TOOLS}/.git" \
"${RPI_TOOLS}/arm-bcm2708/arm-bcm2708-linux-gnueabi" \
"${RPI_TOOLS}/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi" \
"${RPI_TOOLS}/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian" \
"${RPI_TOOLS}/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64" && \
# Then get rid of git as we only needed it to fetch the rpi tools
apt-get purge -qq git && \
# Purge anything that has become useless
apt-get autoremove -qq --purge && \
# And finally do cleanup
apt-get clean -qq && rm -fr /var/lib/apt/* /var/cache/apt/*
# Enable arm v6 in Rust
RUN rustup default nightly \
&& rustup target add arm-unknown-linux-gnueabihf
CMD cargo build --release --target=arm-unknown-linux-gnueabihf