-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.debian-rust
50 lines (47 loc) · 1.49 KB
/
Dockerfile.debian-rust
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# A Rust docker image which can also be used to cross-compile to MUSL for static libs
#
# This is just the official Rust docker image on Debian bullseye, with some additional packages
# installed for libraries that I need to use from Rust, and the musl target.
#
# This environment won't actually work for producing static libraries, as we'll see, but it
# is here to illustrate the problem
FROM rust:1.54-bullseye
RUN apt-get update && apt-get install -yq \
bash \
build-essential \
clang \
cmake \
curl \
e2fsprogs libext2fs-dev \
file \
gcc g++ \
gdb \
git \
graphviz \
libpq-dev \
libprotoc-dev protoc-gen-go \
libsqlite3-dev \
libssl-dev \
libudev-dev \
linux-libc-dev \
musl-dev musl-tools \
llvm llvm-dev \
make \
nodejs npm \
perl \
pkgconf \
sudo \
xfsprogs xfslibs-dev \
xutils-dev \
&& \
apt-get clean && rm -rf /var/lib/apt/lists/*
# Install the sabotage LTS linux kernel headers tweaked specifically for use compiling userland and to support musl
RUN git clone https://github.com/sabotage-linux/kernel-headers.git --branch v4.19.88-1 /tmp/kernel-headers && \
cd /tmp/kernel-headers && \
make ARCH=x86_64 prefix=/usr/local/sabotage install && \
cd / && rm -rf /tmp/kernel-headers
# Static linking for C++ code
RUN ln -s "/usr/bin/g++" "/usr/bin/musl-g++"
RUN rustup component add rustfmt && \
rustup component add clippy && \
rustup target add x86_64-unknown-linux-musl