From 26143f9c2f3c749be8153bebbe98fc47b7dc807c Mon Sep 17 00:00:00 2001 From: Jess Frazelle Date: Fri, 14 Sep 2018 10:13:32 -0400 Subject: [PATCH] better bcc Signed-off-by: Jess Frazelle --- bcc-tools/Dockerfile | 90 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 72 insertions(+), 18 deletions(-) diff --git a/bcc-tools/Dockerfile b/bcc-tools/Dockerfile index 3012577..8b86185 100644 --- a/bcc-tools/Dockerfile +++ b/bcc-tools/Dockerfile @@ -7,28 +7,82 @@ # r.j3ss.co/bcc-tools # FROM debian:buster-slim -LABEL maintainer "Jessie Frazelle " +MAINTAINER Jessica Frazelle -ENV DEBIAN_FRONTEND noninteractive -RUN apt-get update && apt-get install -y \ - apt-transport-https \ - ca-certificates \ - dirmngr \ - gnupg \ - --no-install-recommends \ - && rm -rf /var/lib/apt/lists/* +ENV PATH /go/bin:/usr/local/go/bin:$PATH +ENV GOPATH /go -# add the iovisor repository -RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D4284CDD -RUN echo "deb [trusted=yes] https://repo.iovisor.org/apt/xenial xenial-nightly main" > /etc/apt/sources.list.d/iovisor.list +# 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 \ - binutils \ - bcc-tools \ - libbcc-examples \ - python-bcc \ - --no-install-recommends \ - && rm -rf /var/lib/apt/lists/* + 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 \ + netperf \ + ethtool \ + devscripts \ + zlib1g-dev \ + libfl-dev \ + --no-install-recommends \ + && rm -rf /var/lib/apt/lists/* + +# Build libbcc +ENV BCC_VERSION v0.7.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 + +# 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 + +# Install google/protobuf +ENV PROTOBUF_VERSION v3.6.1 +RUN set -x \ + && export PROTOBUF_PATH="$(mktemp -d)" \ + && curl -fsSL "https://github.com/google/protobuf/archive/${PROTOBUF_VERSION}.tar.gz" \ + | tar -xzC "$PROTOBUF_PATH" --strip-components=1 \ + && ( \ + cd "$PROTOBUF_PATH" \ + && ./autogen.sh \ + && ./configure --prefix=/usr/local \ + && make \ + && make install \ + && ldconfig \ + ) \ + && rm -rf "$PROTOBUFPATH" ENV PATH /usr/share/bcc/tools:$PATH