2017-08-21 11:47:41 -04:00
|
|
|
#!/usr/bin/env bash
|
2016-09-23 12:20:57 -04:00
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
2016-10-24 18:18:58 -04:00
|
|
|
. $(dirname "$0")/binaries-commits
|
2016-09-23 12:20:57 -04:00
|
|
|
|
2016-10-27 19:52:56 -04:00
|
|
|
RM_GOPATH=0
|
|
|
|
|
|
|
|
TMP_GOPATH=${TMP_GOPATH:-""}
|
|
|
|
|
|
|
|
if [ -z "$TMP_GOPATH" ]; then
|
|
|
|
export GOPATH="$(mktemp -d)"
|
|
|
|
RM_GOPATH=1
|
|
|
|
else
|
|
|
|
export GOPATH="$TMP_GOPATH"
|
|
|
|
fi
|
2016-09-23 12:20:57 -04:00
|
|
|
|
2016-10-21 08:34:37 -04:00
|
|
|
# Do not build with ambient capabilities support
|
2016-10-19 14:49:10 -04:00
|
|
|
RUNC_BUILDTAGS="${RUNC_BUILDTAGS:-"seccomp apparmor selinux"}"
|
|
|
|
|
|
|
|
install_runc() {
|
|
|
|
echo "Install runc version $RUNC_COMMIT"
|
2017-08-01 11:51:24 -04:00
|
|
|
git clone https://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc"
|
2016-10-19 14:49:10 -04:00
|
|
|
cd "$GOPATH/src/github.com/opencontainers/runc"
|
|
|
|
git checkout -q "$RUNC_COMMIT"
|
|
|
|
make BUILDTAGS="$RUNC_BUILDTAGS" $1
|
|
|
|
cp runc /usr/local/bin/docker-runc
|
|
|
|
}
|
|
|
|
|
|
|
|
install_containerd() {
|
|
|
|
echo "Install containerd version $CONTAINERD_COMMIT"
|
2017-04-27 17:52:47 -04:00
|
|
|
git clone https://github.com/containerd/containerd.git "$GOPATH/src/github.com/containerd/containerd"
|
|
|
|
cd "$GOPATH/src/github.com/containerd/containerd"
|
2016-10-19 14:49:10 -04:00
|
|
|
git checkout -q "$CONTAINERD_COMMIT"
|
2017-09-22 09:51:05 -04:00
|
|
|
(
|
|
|
|
export GOPATH
|
2017-10-31 11:50:29 -04:00
|
|
|
make
|
|
|
|
)
|
|
|
|
cp bin/containerd /usr/local/bin/docker-containerd
|
|
|
|
cp bin/containerd-shim /usr/local/bin/docker-containerd-shim
|
|
|
|
cp bin/ctr /usr/local/bin/docker-containerd-ctr
|
|
|
|
}
|
|
|
|
|
|
|
|
install_containerd_static() {
|
|
|
|
echo "Install containerd version $CONTAINERD_COMMIT"
|
|
|
|
git clone https://github.com/containerd/containerd.git "$GOPATH/src/github.com/containerd/containerd"
|
|
|
|
cd "$GOPATH/src/github.com/containerd/containerd"
|
|
|
|
git checkout -q "$CONTAINERD_COMMIT"
|
|
|
|
(
|
|
|
|
export GOPATH
|
2017-12-07 20:49:40 -05:00
|
|
|
make BUILDTAGS='static_build netgo' EXTRA_FLAGS="-buildmode pie" EXTRA_LDFLAGS='-extldflags "-fno-PIC -static"'
|
2017-09-22 09:51:05 -04:00
|
|
|
)
|
2016-10-19 14:49:10 -04:00
|
|
|
cp bin/containerd /usr/local/bin/docker-containerd
|
|
|
|
cp bin/containerd-shim /usr/local/bin/docker-containerd-shim
|
|
|
|
cp bin/ctr /usr/local/bin/docker-containerd-ctr
|
|
|
|
}
|
|
|
|
|
2016-10-27 19:52:56 -04:00
|
|
|
install_proxy() {
|
|
|
|
echo "Install docker-proxy version $LIBNETWORK_COMMIT"
|
|
|
|
git clone https://github.com/docker/libnetwork.git "$GOPATH/src/github.com/docker/libnetwork"
|
|
|
|
cd "$GOPATH/src/github.com/docker/libnetwork"
|
|
|
|
git checkout -q "$LIBNETWORK_COMMIT"
|
|
|
|
go build -ldflags="$PROXY_LDFLAGS" -o /usr/local/bin/docker-proxy github.com/docker/libnetwork/cmd/proxy
|
|
|
|
}
|
|
|
|
|
2017-04-17 19:18:46 -04:00
|
|
|
install_dockercli() {
|
2017-08-17 17:27:41 -04:00
|
|
|
DOCKERCLI_CHANNEL=${DOCKERCLI_CHANNEL:-edge}
|
|
|
|
DOCKERCLI_VERSION=${DOCKERCLI_VERSION:-17.06.0-ce}
|
|
|
|
echo "Install docker/cli version $DOCKERCLI_VERSION from $DOCKERCLI_CHANNEL"
|
|
|
|
|
|
|
|
arch=$(uname -m)
|
2017-08-21 11:47:41 -04:00
|
|
|
# No official release of these platforms
|
|
|
|
if [[ "$arch" != "x86_64" ]] && [[ "$arch" != "s390x" ]]; then
|
|
|
|
build_dockercli
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2017-08-17 17:27:41 -04:00
|
|
|
url=https://download.docker.com/linux/static
|
|
|
|
curl -Ls $url/$DOCKERCLI_CHANNEL/$arch/docker-$DOCKERCLI_VERSION.tgz | \
|
|
|
|
tar -xz docker/docker
|
|
|
|
mv docker/docker /usr/local/bin/
|
|
|
|
rmdir docker
|
2017-04-17 19:18:46 -04:00
|
|
|
}
|
|
|
|
|
2017-08-21 11:47:41 -04:00
|
|
|
build_dockercli() {
|
|
|
|
DOCKERCLI_VERSION=${DOCKERCLI_VERSION:-17.06.0-ce}
|
|
|
|
git clone https://github.com/docker/docker-ce "$GOPATH/tmp/docker-ce"
|
|
|
|
cd "$GOPATH/tmp/docker-ce"
|
|
|
|
git checkout -q "v$DOCKERCLI_VERSION"
|
|
|
|
mkdir -p "$GOPATH/src/github.com/docker"
|
|
|
|
mv components/cli "$GOPATH/src/github.com/docker/cli"
|
2017-04-17 19:18:46 -04:00
|
|
|
go build -o /usr/local/bin/docker github.com/docker/cli/cmd/docker
|
|
|
|
}
|
|
|
|
|
2017-08-17 13:52:14 -04:00
|
|
|
install_gometalinter() {
|
|
|
|
echo "Installing gometalinter version $GOMETALINTER_COMMIT"
|
|
|
|
go get -d github.com/alecthomas/gometalinter
|
|
|
|
cd "$GOPATH/src/github.com/alecthomas/gometalinter"
|
|
|
|
git checkout -q "$GOMETALINTER_COMMIT"
|
|
|
|
go build -o /usr/local/bin/gometalinter github.com/alecthomas/gometalinter
|
2017-08-21 17:51:45 -04:00
|
|
|
GOBIN=/usr/local/bin gometalinter --install
|
2017-08-17 13:52:14 -04:00
|
|
|
}
|
|
|
|
|
2016-09-23 12:20:57 -04:00
|
|
|
for prog in "$@"
|
|
|
|
do
|
|
|
|
case $prog in
|
|
|
|
tomlv)
|
|
|
|
echo "Install tomlv version $TOMLV_COMMIT"
|
|
|
|
git clone https://github.com/BurntSushi/toml.git "$GOPATH/src/github.com/BurntSushi/toml"
|
|
|
|
cd "$GOPATH/src/github.com/BurntSushi/toml" && git checkout -q "$TOMLV_COMMIT"
|
|
|
|
go build -v -o /usr/local/bin/tomlv github.com/BurntSushi/toml/cmd/tomlv
|
|
|
|
;;
|
|
|
|
|
|
|
|
runc)
|
2016-10-19 14:49:10 -04:00
|
|
|
install_runc static
|
|
|
|
;;
|
|
|
|
|
|
|
|
runc-dynamic)
|
|
|
|
install_runc
|
2016-09-23 12:20:57 -04:00
|
|
|
;;
|
|
|
|
|
|
|
|
containerd)
|
2017-10-31 11:50:29 -04:00
|
|
|
install_containerd_static
|
2016-10-19 14:49:10 -04:00
|
|
|
;;
|
|
|
|
|
|
|
|
containerd-dynamic)
|
|
|
|
install_containerd
|
2016-09-23 12:20:57 -04:00
|
|
|
;;
|
|
|
|
|
2017-08-17 13:52:14 -04:00
|
|
|
gometalinter)
|
|
|
|
install_gometalinter
|
|
|
|
;;
|
|
|
|
|
2016-11-03 12:47:50 -04:00
|
|
|
tini)
|
|
|
|
echo "Install tini version $TINI_COMMIT"
|
|
|
|
git clone https://github.com/krallin/tini.git "$GOPATH/tini"
|
|
|
|
cd "$GOPATH/tini"
|
|
|
|
git checkout -q "$TINI_COMMIT"
|
2016-11-15 17:07:13 -05:00
|
|
|
cmake .
|
2016-11-03 12:47:50 -04:00
|
|
|
make tini-static
|
|
|
|
cp tini-static /usr/local/bin/docker-init
|
2016-09-23 12:20:57 -04:00
|
|
|
;;
|
|
|
|
|
2016-10-18 19:30:47 -04:00
|
|
|
proxy)
|
2017-05-04 20:18:00 -04:00
|
|
|
(
|
|
|
|
export CGO_ENABLED=0
|
|
|
|
install_proxy
|
|
|
|
)
|
2016-10-27 19:52:56 -04:00
|
|
|
;;
|
|
|
|
|
|
|
|
proxy-dynamic)
|
|
|
|
PROXY_LDFLAGS="-linkmode=external" install_proxy
|
2016-10-18 19:30:47 -04:00
|
|
|
;;
|
|
|
|
|
2016-10-31 14:22:28 -04:00
|
|
|
vndr)
|
|
|
|
echo "Install vndr version $VNDR_COMMIT"
|
|
|
|
git clone https://github.com/LK4D4/vndr.git "$GOPATH/src/github.com/LK4D4/vndr"
|
|
|
|
cd "$GOPATH/src/github.com/LK4D4/vndr"
|
|
|
|
git checkout -q "$VNDR_COMMIT"
|
|
|
|
go build -v -o /usr/local/bin/vndr .
|
|
|
|
;;
|
|
|
|
|
2017-04-17 19:18:46 -04:00
|
|
|
dockercli)
|
|
|
|
install_dockercli
|
|
|
|
;;
|
2016-12-20 16:26:49 -05:00
|
|
|
|
2016-09-23 12:20:57 -04:00
|
|
|
*)
|
2017-08-17 13:52:14 -04:00
|
|
|
echo echo "Usage: $0 [tomlv|runc|runc-dynamic|containerd|containerd-dynamic|tini|proxy|proxy-dynamic|vndr|dockercli|gometalinter]"
|
2016-09-23 12:20:57 -04:00
|
|
|
exit 1
|
|
|
|
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2016-10-27 19:52:56 -04:00
|
|
|
if [ $RM_GOPATH -eq 1 ]; then
|
|
|
|
rm -rf "$GOPATH"
|
|
|
|
fi
|