github.com/fafucoder/cilium@v1.6.11/contrib/packaging/docker/Dockerfile.runtime (about)

     1  #
     2  # Cilium runtime base image
     3  #
     4  FROM docker.io/library/ubuntu:18.04 as runtime-base
     5  RUN apt-get update && \
     6  apt-get upgrade -y && \
     7  #
     8  # Prepackaged Cilium runtime dependencies
     9  #
    10  apt-get install -y --no-install-recommends \
    11      gpg gpg-agent libelf-dev libmnl-dev libc6-dev-i386 iptables libgcc-5-dev \
    12      bash-completion binutils binutils-dev ca-certificates clang-7 llvm-7 kmod && \
    13  apt-get purge --auto-remove && \
    14  apt-get clean && \
    15  #
    16  # clang-7
    17  #
    18  rm -fr /usr/lib/llvm-7/include/llvm-c && \
    19  rm -fr /usr/lib/llvm-7/include/clang-c && \
    20  rm -fr /usr/lib/llvm-7/include/c++ && \
    21  rm -fr /usr/lib/llvm-7/include/polly && \
    22  rm -fr /usr/lib/llvm-7/share && \
    23  ls -d /usr/lib/llvm-7/lib/* | grep -vE clang$ | xargs rm -r && \
    24  ls -d /usr/lib/llvm-7/bin/* | grep -vE "clang$|clang-7$|llc$" | xargs basename -a | awk '{ print "/usr/bin/"$1"-7" }' | xargs rm -r && \
    25  ls -d /usr/lib/llvm-7/bin/* | grep -vE "clang$|clang-7$|llc$" | xargs rm -r && \
    26  strip /usr/lib/llvm-7/bin/* && \
    27  update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-7/bin/clang 1000 && \
    28  update-alternatives --install /usr/bin/llc llc /usr/lib/llvm-7/bin/llc 1000
    29  
    30  #
    31  # Build Cilium runtime dependencies.
    32  #
    33  FROM runtime-base as runtime-build
    34  WORKDIR /tmp
    35  RUN \
    36  #
    37  # Build dependencies
    38  #
    39  apt-get update && \
    40  apt-get install -y --no-install-recommends make git curl ca-certificates xz-utils \
    41  # Additional iproute2 build dependencies
    42    gcc git pkg-config bison flex build-essential \
    43  # Additional bpftool dependencies
    44    python3 && \
    45  #
    46  # iproute2
    47  #
    48  git clone --depth 1 -b static-data https://github.com/cilium/iproute2.git iproute2 && \
    49  cd iproute2 && \
    50  ./configure && \
    51  make -j `getconf _NPROCESSORS_ONLN` && \
    52  strip tc/tc && \
    53  strip ip/ip && \
    54  cd .. && \
    55  #
    56  # bpftool
    57  #
    58  git clone --depth 1 -b master git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git && \
    59  cd linux/tools/bpf/bpftool/ && \
    60  make -j `getconf _NPROCESSORS_ONLN` && \
    61  strip bpftool && \
    62  cd ../../../../ && \
    63  #
    64  # bpf-map
    65  #
    66  curl -SsL https://github.com/cilium/bpf-map/releases/download/v1.0/bpf-map -o bpf-map && \
    67  chmod +x bpf-map && \
    68  strip bpf-map && \
    69  #
    70  # cni/loopback
    71  #
    72  curl -sS -L https://github.com/containernetworking/plugins/releases/download/v0.7.5/cni-plugins-amd64-v0.7.5.tgz -o cni.tar.gz && \
    73  tar -xvf cni.tar.gz ./loopback && \
    74  strip -s ./loopback && \
    75  #
    76  # Cleanup
    77  #
    78  apt-get purge --auto-remove -y gpg gpg-agent gcc make bison flex git curl xz-utils ca-certificates && \
    79  apt-get clean
    80  
    81  #
    82  # Go-based tools we need at runtime
    83  #
    84  FROM docker.io/library/golang:1.12.17 as runtime-gobuild
    85  WORKDIR /tmp
    86  RUN go get -d github.com/google/gops && \
    87  cd /go/src/github.com/google/gops && \
    88  git checkout -b v0.3.6 v0.3.6 && \
    89  go install && \
    90  strip /go/bin/gops
    91  
    92  #
    93  # Stripped cilium runtime base image
    94  #
    95  FROM runtime-base
    96  LABEL maintainer="maintainer@cilium.io"
    97  WORKDIR /bin
    98  COPY --from=runtime-build /tmp/iproute2/tc/tc /tmp/iproute2/ip/ip ./
    99  COPY --from=runtime-build /tmp/linux/tools/bpf/bpftool/bpftool ./
   100  COPY --from=runtime-build /tmp/bpf-map ./
   101  COPY --from=runtime-gobuild /go/bin/gops ./
   102  WORKDIR /cni
   103  COPY --from=runtime-build /tmp/loopback ./