github.com/zhouyu0/docker-note@v0.0.0-20190722021225-b8d3825084db/hack/dockerfile/install/containerd.installer (about)

     1  #!/bin/sh
     2  
     3  
     4  # containerd is also pinned in vendor.conf. When updating the binary
     5  # version you may also need to update the vendor version to pick up bug
     6  # fixes or new APIs.
     7  CONTAINERD_COMMIT=894b81a4b802e4eb2a91d1ce216b8817763c29fb # v1.2.6
     8  
     9  install_containerd() {
    10  	echo "Install containerd version $CONTAINERD_COMMIT"
    11  	git clone https://github.com/containerd/containerd.git "$GOPATH/src/github.com/containerd/containerd"
    12  	cd "$GOPATH/src/github.com/containerd/containerd"
    13  	git checkout -q "$CONTAINERD_COMMIT"
    14  
    15  	(
    16  
    17  		export BUILDTAGS='netgo osusergo static_build'
    18  		export EXTRA_FLAGS='-buildmode=pie'
    19  		export EXTRA_LDFLAGS='-extldflags "-fno-PIC -static"'
    20  
    21  		# Reset build flags to nothing if we want a dynbinary
    22  		if [ "$1" == "dynamic" ]; then
    23  			export BUILDTAGS=''
    24  			export EXTRA_FLAGS=''
    25  			export EXTRA_LDFLAGS=''
    26  		fi
    27  
    28  		make
    29  	)
    30  
    31  	mkdir -p ${PREFIX}
    32  
    33  	cp bin/containerd ${PREFIX}/containerd
    34  	cp bin/containerd-shim ${PREFIX}/containerd-shim
    35  	cp bin/ctr ${PREFIX}/ctr
    36  }