forked from facebookincubator/below
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
72 lines (56 loc) · 1.75 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
FROM ubuntu:groovy AS build
ARG RUN_TESTS
RUN apt-get update
RUN apt-get install -y \
build-essential \
ca-certificates \
clang \
curl \
git \
libbpf-dev \
libelf-dev \
libncursesw5-dev \
libssl-dev \
m4 \
python3 \
zlib1g-dev
WORKDIR /
ADD . /resctl
# Build and install fbthrift
RUN mkdir /fbthrift
RUN /resctl/build/fbcode_builder/getdeps.py build fbthrift --install-prefix /fbthrift
# Must set THRIFT env var for build to find fbthrift installation
ENV THRIFT /fbthrift/fbthrift/bin/thrift1
# Install nightly rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > /rustup.sh
RUN chmod +x /rustup.sh
RUN bash /rustup.sh -y --default-toolchain nightly
# Install libbpf-rs tooling
RUN /root/.cargo/bin/cargo install libbpf-cargo
# Build below
WORKDIR resctl
RUN /root/.cargo/bin/cargo libbpf make -- --release --package resctl_below
# Run tests if requested
RUN if [[ -n "$RUN_TESTS" ]]; then \
/root/.cargo/bin/cargo test -- \
--skip test_dump \
--skip advance_forward_and_reverse \
--skip disable_disk_stat \
stdout \
--skip disable_io_stat; \
fi
# Now create stage 2 image. We drop all the build dependencies and only install
# runtime dependencies. This will create a smaller image suitable for
# distribution.
FROM ubuntu:groovy
# Default locale is "POSIX" which doesn't seem to play well with UTF-8. Cursive
# uses UTF-8 to draw lines so we need to set this locale otherwise our lines
# will be garbled. See https://github.com/gyscos/cursive/issues/13 .
ENV LANG C.UTF-8
RUN apt-get update
RUN apt-get install -y \
libelf1 \
libncursesw5 \
zlib1g
COPY --from=build /resctl/target/release/below /below
ENTRYPOINT ["/below"]