github.com/Heebron/moby@v0.0.0-20221111184709-6eab4f55faf7/hack/dockerfile/install/containerd.installer (about)

     1  #!/bin/sh
     2  set -e
     3  
     4  # CONTAINERD_VERSION specifies the version of the containerd runtime binary
     5  # to install from the https://github.com/containerd/containerd repository.
     6  #
     7  # This version is used to build statically compiled containerd binaries, and
     8  # used for the integration tests. The distributed docker .deb and .rpm packages
     9  # depend on a separate (containerd.io) package, which may be a different version
    10  # as is specified here.
    11  #
    12  # Generally, the commit specified here should match a tagged release.
    13  #
    14  # The containerd golang package is also pinned in vendor.mod. When updating
    15  # the binary version you may also need to update the vendor version to pick up
    16  # bug fixes or new APIs, however, usually the Go packages are built from a
    17  # commit from the master branch.
    18  : "${CONTAINERD_VERSION:=v1.6.9}"
    19  
    20  install_containerd() (
    21  	echo "Install containerd version $CONTAINERD_VERSION"
    22  	git clone https://github.com/containerd/containerd.git "$GOPATH/src/github.com/containerd/containerd"
    23  	cd "$GOPATH/src/github.com/containerd/containerd"
    24  	git checkout -q "$CONTAINERD_VERSION"
    25  
    26  	export BUILDTAGS='netgo osusergo static_build'
    27  	export EXTRA_FLAGS=${GO_BUILDMODE}
    28  	export EXTRA_LDFLAGS='-extldflags "-fno-PIC -static"'
    29  
    30  	# Reset build flags to nothing if we want a dynbinary
    31  	if [ "$1" = "dynamic" ]; then
    32  		export BUILDTAGS=''
    33  		export EXTRA_FLAGS=''
    34  		export EXTRA_LDFLAGS=''
    35  	fi
    36  	make
    37  
    38  	install -D bin/containerd "${PREFIX}/containerd"
    39  	install -D bin/containerd-shim-runc-v2 "${PREFIX}/containerd-shim-runc-v2"
    40  	install -D bin/ctr "${PREFIX}/ctr"
    41  )