github.com/skf/moby@v1.13.1/hack/dockerfile/install-binaries.sh (about) 1 #!/bin/sh 2 set -e 3 set -x 4 5 . $(dirname "$0")/binaries-commits 6 7 RM_GOPATH=0 8 9 TMP_GOPATH=${TMP_GOPATH:-""} 10 11 if [ -z "$TMP_GOPATH" ]; then 12 export GOPATH="$(mktemp -d)" 13 RM_GOPATH=1 14 else 15 export GOPATH="$TMP_GOPATH" 16 fi 17 18 # Do not build with ambient capabilities support 19 RUNC_BUILDTAGS="${RUNC_BUILDTAGS:-"seccomp apparmor selinux"}" 20 21 install_runc() { 22 echo "Install runc version $RUNC_COMMIT" 23 git clone https://github.com/docker/runc.git "$GOPATH/src/github.com/opencontainers/runc" 24 cd "$GOPATH/src/github.com/opencontainers/runc" 25 git checkout -q "$RUNC_COMMIT" 26 make BUILDTAGS="$RUNC_BUILDTAGS" $1 27 cp runc /usr/local/bin/docker-runc 28 } 29 30 install_containerd() { 31 echo "Install containerd version $CONTAINERD_COMMIT" 32 git clone https://github.com/docker/containerd.git "$GOPATH/src/github.com/docker/containerd" 33 cd "$GOPATH/src/github.com/docker/containerd" 34 git checkout -q "$CONTAINERD_COMMIT" 35 make $1 36 cp bin/containerd /usr/local/bin/docker-containerd 37 cp bin/containerd-shim /usr/local/bin/docker-containerd-shim 38 cp bin/ctr /usr/local/bin/docker-containerd-ctr 39 } 40 41 install_proxy() { 42 echo "Install docker-proxy version $LIBNETWORK_COMMIT" 43 git clone https://github.com/docker/libnetwork.git "$GOPATH/src/github.com/docker/libnetwork" 44 cd "$GOPATH/src/github.com/docker/libnetwork" 45 git checkout -q "$LIBNETWORK_COMMIT" 46 go build -ldflags="$PROXY_LDFLAGS" -o /usr/local/bin/docker-proxy github.com/docker/libnetwork/cmd/proxy 47 } 48 49 install_bindata() { 50 echo "Install go-bindata version $BINDATA_COMMIT" 51 git clone https://github.com/jteeuwen/go-bindata "$GOPATH/src/github.com/jteeuwen/go-bindata" 52 cd $GOPATH/src/github.com/jteeuwen/go-bindata 53 git checkout -q "$BINDATA_COMMIT" 54 go build -o /usr/local/bin/go-bindata github.com/jteeuwen/go-bindata/go-bindata 55 } 56 57 for prog in "$@" 58 do 59 case $prog in 60 tomlv) 61 echo "Install tomlv version $TOMLV_COMMIT" 62 git clone https://github.com/BurntSushi/toml.git "$GOPATH/src/github.com/BurntSushi/toml" 63 cd "$GOPATH/src/github.com/BurntSushi/toml" && git checkout -q "$TOMLV_COMMIT" 64 go build -v -o /usr/local/bin/tomlv github.com/BurntSushi/toml/cmd/tomlv 65 ;; 66 67 runc) 68 install_runc static 69 ;; 70 71 runc-dynamic) 72 install_runc 73 ;; 74 75 containerd) 76 install_containerd static 77 ;; 78 79 containerd-dynamic) 80 install_containerd 81 ;; 82 83 tini) 84 echo "Install tini version $TINI_COMMIT" 85 git clone https://github.com/krallin/tini.git "$GOPATH/tini" 86 cd "$GOPATH/tini" 87 git checkout -q "$TINI_COMMIT" 88 cmake . 89 make tini-static 90 cp tini-static /usr/local/bin/docker-init 91 ;; 92 93 proxy) 94 export CGO_ENABLED=0 95 install_proxy 96 ;; 97 98 proxy-dynamic) 99 PROXY_LDFLAGS="-linkmode=external" install_proxy 100 ;; 101 102 vndr) 103 echo "Install vndr version $VNDR_COMMIT" 104 git clone https://github.com/LK4D4/vndr.git "$GOPATH/src/github.com/LK4D4/vndr" 105 cd "$GOPATH/src/github.com/LK4D4/vndr" 106 git checkout -q "$VNDR_COMMIT" 107 go build -v -o /usr/local/bin/vndr . 108 ;; 109 110 bindata) 111 install_bindata 112 ;; 113 114 *) 115 echo echo "Usage: $0 [tomlv|runc|containerd|tini|proxy]" 116 exit 1 117 118 esac 119 done 120 121 if [ $RM_GOPATH -eq 1 ]; then 122 rm -rf "$GOPATH" 123 fi