github.com/cilium/cilium@v1.16.2/images/builder/Dockerfile (about)

     1  # Copyright Authors of Cilium
     2  # SPDX-License-Identifier: Apache-2.0
     3  
     4  ARG COMPILERS_IMAGE=quay.io/cilium/image-compilers:5569a29cea6b3ad50aeb03102aaf3dc03841197c@sha256:b15dbedb7c49816c74a765e2f6ecdb9359763b8e4e4328d794f48b9cefae9804
     5  ARG CILIUM_RUNTIME_IMAGE=quay.io/cilium/cilium-runtime:379737f7353dfedc7a5dfff8a148c2635293803e@sha256:212896b5947cbfba128eb4d985bc4003a45078228c9b9e31c7c5a049d7ea612a
     6  ARG TESTER_IMAGE=quay.io/cilium/image-tester:dd09c8d3ef349a909fbcdc99279516baef153f22@sha256:c056d064cb47c97acd607343db5457e1d49d9338d6d8a87e93e23cc93f052c73
     7  ARG GOLANG_IMAGE=docker.io/library/golang:1.22.7@sha256:4594271250150c1a322ed749abfd218e1a8c6eb1ade90872e325a664412e2037
     8  ARG CILIUM_LLVM_IMAGE=quay.io/cilium/cilium-llvm:9f1bfe736009afb1fbb562718bbc42ea07d37d8e@sha256:a666a7a01a2dc610c3ab6e32f25ca5e294201f3cbbc01f233320c527955deee3
     9  
    10  FROM ${COMPILERS_IMAGE} AS compilers-image
    11  
    12  FROM ${GOLANG_IMAGE} AS golang-dist
    13  
    14  FROM ${CILIUM_LLVM_IMAGE} AS llvm-dist
    15  
    16  FROM ${CILIUM_RUNTIME_IMAGE} AS rootfs
    17  
    18  # Change the number to force the generation of a new git-tree SHA. Useful when
    19  # we want to re-run 'apt-get upgrade' for stale images.
    20  ENV FORCE_BUILD=1
    21  
    22  # TARGETARCH is an automatic platform ARG enabled by Docker BuildKit.
    23  ARG TARGETARCH
    24  RUN \
    25      apt-get update && \
    26      apt-get upgrade -y --no-install-recommends && \
    27      apt-get install -y --no-install-recommends \
    28        # Install cross tools for both arm64 on amd64
    29        gcc-aarch64-linux-gnu \
    30        g++-aarch64-linux-gnu \
    31        libc6-dev-arm64-cross \
    32        binutils-aarch64-linux-gnu \
    33        gcc-x86-64-linux-gnu \
    34        g++-x86-64-linux-gnu \
    35        libc6-dev-amd64-cross \
    36        binutils-x86-64-linux-gnu \
    37        # Dependencies to unzip protoc
    38        unzip \
    39        # Base Cilium-build dependencies
    40        binutils \
    41        coreutils \
    42        curl \
    43        gcc \
    44        git \
    45        libc6-dev \
    46        make && \
    47      apt-get purge --auto-remove && \
    48      apt-get clean && \
    49      rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
    50  
    51  COPY --from=compilers-image /usr/lib/aarch64-linux-gnu /usr/lib/aarch64-linux-gnu
    52  
    53  COPY --from=golang-dist /usr/local/go /usr/local/go
    54  RUN mkdir -p /go
    55  ENV GOROOT /usr/local/go
    56  ENV GOPATH /go
    57  ENV PATH "${GOROOT}/bin:${GOPATH}/bin:${PATH}"
    58  
    59  RUN CGO_ENABLED=0 go install github.com/go-delve/delve/cmd/dlv@latest
    60  
    61  WORKDIR /go/src/github.com/cilium/cilium/images/builder
    62  RUN --mount=type=bind,readwrite,target=/go/src/github.com/cilium/cilium/images/builder \
    63      ./install-gitconfig.sh
    64  
    65  WORKDIR /go/src/github.com/cilium/cilium/images/builder
    66  RUN --mount=type=bind,readwrite,target=/go/src/github.com/cilium/cilium/images/builder \
    67      --mount=type=cache,target=/root/.cache \
    68      --mount=type=cache,target=/go/pkg \
    69      ./build-debug-wrapper.sh
    70  
    71  WORKDIR /go/src/github.com/cilium/cilium/images/builder
    72  RUN --mount=type=bind,readwrite,target=/go/src/github.com/cilium/cilium/images/builder \
    73      ./install-protoc.sh
    74  
    75  RUN --mount=type=bind,readwrite,target=/go/src/github.com/cilium/cilium/images/builder \
    76      ./install-protoplugins.sh
    77  
    78  # used to facilitate the verifier tests
    79  COPY --from=llvm-dist /usr/local/bin/llvm-objcopy /bin/
    80  
    81  # Create a cache directory with 777 so that we can run the builder image and
    82  # compile golang code from any UID.
    83  RUN mkdir -p /.cache && chmod 777 /.cache && \
    84      mkdir -p /go/bin && chmod 777 /go/bin
    85  
    86  FROM ${TESTER_IMAGE} as test
    87  COPY --from=rootfs / /
    88  COPY test /test
    89  RUN /test/bin/cst
    90  
    91  # this image is large, and re-using layers is beneficial,
    92  # so final images is not squashed
    93  FROM rootfs as release
    94  LABEL maintainer="maintainer@cilium.io"
    95  WORKDIR /go/src/github.com/cilium/cilium