github.com/containerd/Containerd@v1.4.13/contrib/Dockerfile.test (about)

     1  # This dockerfile is used to test containerd within a container
     2  #
     3  # usage:
     4  # 1.) docker build -t containerd-test -f Dockerfile.test ../
     5  # 2.) docker run -it --privileged -v /tmp:/tmp --tmpfs /var/lib/containerd-test containerd-test  bash
     6  # 3.) $ make binaries install test
     7  #
     8  # Use the RUNC_VERSION build-arg to build with a custom version of runc, for example,
     9  # to build runc v1.0.0-rc93, use:
    10  #
    11  # docker build -t containerd-test --build-arg RUNC_VERSION=v1.0.0-rc93 -f Dockerfile.test ../
    12  
    13  ARG GOLANG_VERSION=1.16.14
    14  
    15  FROM golang:${GOLANG_VERSION} AS golang-base
    16  RUN mkdir -p /go/src/github.com/containerd/containerd
    17  WORKDIR /go/src/github.com/containerd/containerd
    18  
    19  # Install proto3
    20  FROM golang-base AS proto3
    21  RUN apt-get update && apt-get install -y \
    22     autoconf \
    23     automake \
    24     g++ \
    25     libtool \
    26     unzip \
    27   --no-install-recommends
    28  
    29  COPY script/setup/install-protobuf install-protobuf
    30  RUN ./install-protobuf
    31  
    32  # Install runc
    33  FROM golang-base AS runc
    34  RUN apt-get update && apt-get install -y \
    35      curl \
    36      libseccomp-dev \
    37    --no-install-recommends
    38  
    39  COPY script/setup/runc-version script/setup/install-runc ./
    40  # Allow overriding the version of runc to install through build-args
    41  ARG RUNC_VERSION
    42  ARG GOPROXY=direct
    43  ARG GO111MODULE=off
    44  RUN ./install-runc
    45  
    46  FROM golang-base AS dev
    47  RUN apt-get update && apt-get install -y \
    48      libbtrfs-dev \
    49      btrfs-progs \
    50      gcc \
    51      git \
    52      libseccomp-dev \
    53      make \
    54      xfsprogs \
    55    --no-install-recommends
    56  
    57  COPY --from=proto3 /usr/local/bin/protoc     /usr/local/bin/protoc
    58  COPY --from=proto3 /usr/local/include/google /usr/local/include/google
    59  COPY --from=runc   /usr/local/sbin/runc      /usr/local/go/bin/runc
    60  
    61  COPY . .