2018-02-16 13:51:30 -05:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# LIBNETWORK_COMMIT is used to build the docker-userland-proxy binary. When
|
|
|
|
# updating the binary version, consider updating github.com/docker/libnetwork
|
|
|
|
# in vendor.conf accordingly
|
2019-09-03 05:45:19 -04:00
|
|
|
LIBNETWORK_COMMIT=92d1fbe1eb0883cf11d283cea8e658275146411d
|
2018-02-16 13:51:30 -05:00
|
|
|
|
|
|
|
install_proxy() {
|
|
|
|
case "$1" in
|
|
|
|
"dynamic")
|
|
|
|
install_proxy_dynamic
|
|
|
|
return
|
|
|
|
;;
|
|
|
|
"")
|
|
|
|
export CGO_ENABLED=0
|
|
|
|
_install_proxy
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo 'Usage: $0 [dynamic]'
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
install_proxy_dynamic() {
|
|
|
|
export PROXY_LDFLAGS="-linkmode=external" install_proxy
|
2018-03-07 16:29:10 -05:00
|
|
|
export BUILD_MODE="-buildmode=pie"
|
2018-02-16 13:51:30 -05:00
|
|
|
_install_proxy
|
|
|
|
}
|
|
|
|
|
|
|
|
_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"
|
2018-12-22 14:18:33 -05:00
|
|
|
go build ${BUILD_MODE} -ldflags="$PROXY_LDFLAGS" -o ${PREFIX}/docker-proxy github.com/docker/libnetwork/cmd/proxy
|
2018-02-16 13:51:30 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|