-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathDockerfile
96 lines (83 loc) · 2.13 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
FROM debian:stretch-slim as builder
MAINTAINER Jessica Frazelle <[email protected]>
ENV PATH /go/bin:/usr/local/go/bin:$PATH
ENV GOPATH /go
# Add non-free apt sources
RUN sed -i "s#deb http://deb.debian.org/debian buster main#deb http://deb.debian.org/debian buster main contrib non-free#g" /etc/apt/sources.list
RUN apt-get update && apt-get install -y \
ca-certificates \
clang \
curl \
gcc \
git \
g++ \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
# Install dependencies for libbcc
# FROM: https://github.com/iovisor/bcc/blob/master/INSTALL.md#install-build-dependencies
RUN apt-get update && apt-get install -y \
debhelper \
cmake \
libllvm3.9 \
llvm-dev \
libclang-dev \
libelf-dev \
bison \
flex \
libedit-dev \
clang-format \
python \
python-netaddr \
python-pyroute2 \
luajit \
libluajit-5.1-dev \
arping \
iperf \
ethtool \
devscripts \
zlib1g-dev \
libfl-dev \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
# Build libbcc
ENV BCC_VERSION v0.9.0
RUN git clone --depth 1 --branch "$BCC_VERSION" https://github.com/iovisor/bcc.git /usr/src/bcc
WORKDIR /usr/src/bcc
RUN mkdir build \
&& cd build \
&& cmake .. -DCMAKE_INSTALL_PREFIX=/usr \
&& make \
&& make install \
&& make clean \
&& make
# Install Go
ENV GO_VERSION 1.11
RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" \
| tar -xzC /usr/local
COPY . /go/src/github.com/genuinetools/bpfd
WORKDIR /go/src/github.com/genuinetools/bpfd
RUN make \
&& mv bpfd /usr/bin/bpfd
FROM debian:stretch-slim
# Add non-free apt sources
RUN sed -i "s#deb http://deb.debian.org/debian buster main#deb http://deb.debian.org/debian buster main contrib non-free#g" /etc/apt/sources.list
RUN apt-get update && apt-get install -y \
bison \
ca-certificates \
clang \
cmake \
flex \
git \
libclang-dev \
libelf-dev \
libluajit-5.1-dev \
llvm-dev \
make \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/bin/bpfd /usr/bin/bpfd
COPY --from=builder /usr/src/bcc /usr/src/bcc
COPY examples /etc/bpfd/
RUN cd /usr/src/bcc/build && make install
ENTRYPOINT [ "bpfd" ]
CMD [ "--help" ]