install-binaries.sh 2.7 KB

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