-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
47 lines (35 loc) · 2.04 KB
/
Dockerfile
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
# `docker build -f dev-dockerfile -t local/network-debugger:latest .`
# `docker run --rm --privileged -v /sys/kernel/debug:/sys/kernel/debug local/network-debugger:latest`
FROM ubuntu:20.04 as builder
ARG linker_src="https://github.com/vlad9486/bpf-linker"
ARG linker_branch="keep-btf"
ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN DEBIAN_FRONTEND=noninteractive apt-get update \
&& apt-get install -y git curl clang make pkg-config libelf-dev \
protobuf-compiler libbz2-dev libssl-dev
RUN curl -sSL https://capnproto.org/capnproto-c++-0.10.2.tar.gz | tar -zxf - \
&& cd capnproto-c++-0.10.2 \
&& ./configure \
&& make -j6 check \
&& make install \
&& cd .. \
&& rm -rf capnproto-c++-0.10.2
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH=/root/.cargo/bin:$PATH
RUN rustup update nightly-2022-10-10 && rustup update nightly-2022-12-10 && rustup default stable
RUN rustup component add rust-src \
--toolchain nightly-2022-10-10-x86_64-unknown-linux-gnu
RUN cargo +nightly-2022-12-10 install bpf-linker --git ${linker_src} --branch ${linker_branch}
# RUN cargo install --git https://github.com/openmina/mina-network-debugger bpf-recorder --bin bpf-recorder
COPY . .
RUN CARGO_TARGET_DIR=target/bpf cargo +nightly-2022-10-10 rustc --package=bpf-recorder --bin=bpf-recorder-kern --features=kern --no-default-features --target=bpfel-unknown-none -Z build-std=core --release -- -Cdebuginfo=2 -Clink-arg=--disable-memory-builtins -Clink-arg=--keep-btf
RUN cargo install --path bpf-recorder bpf-recorder
RUN cargo install --path mina-aggregator mina-aggregator
RUN cargo install --path topology-tool topology-tool
FROM ubuntu:20.04
RUN apt-get update && apt-get install -y zlib1g libelf1 libgcc1 libssl-dev
COPY --from=builder /root/.cargo/bin/bpf-recorder /usr/bin/bpf-recorder
COPY --from=builder /root/.cargo/bin/mina-aggregator /usr/bin/mina-aggregator
COPY --from=builder /root/.cargo/bin/topology-tool /usr/bin/topology-tool
ENTRYPOINT ["/usr/bin/bpf-recorder"]