github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/hack/dockerfile/install/proxy.installer (about)

     1  #!/bin/sh
     2  
     3  # LIBNETWORK_COMMIT is used to build the docker-userland-proxy binary. When
     4  # updating the binary version, consider updating github.com/demonoid81/libnetwork
     5  # in vendor.conf accordingly
     6  : "${LIBNETWORK_COMMIT:=ef149a924dfde2e506ea3cb3f617d7d0fa96b8ee}"
     7  
     8  install_proxy() {
     9  	case "$1" in
    10  		"dynamic")
    11  			install_proxy_dynamic
    12  			return
    13  			;;
    14  		"")
    15  			export CGO_ENABLED=0
    16  			_install_proxy
    17  			;;
    18  		*)
    19  			echo 'Usage: $0 [dynamic]'
    20  			;;
    21  	esac
    22  }
    23  
    24  install_proxy_dynamic() {
    25  	export PROXY_LDFLAGS="-linkmode=external" install_proxy
    26  	export BUILD_MODE="-buildmode=pie"
    27  	_install_proxy
    28  }
    29  
    30  _install_proxy() {
    31  	echo "Install docker-proxy version $LIBNETWORK_COMMIT"
    32  	git clone https://github.com/demonoid81/libnetwork.git "$GOPATH/src/github.com/demonoid81/libnetwork"
    33  	cd "$GOPATH/src/github.com/demonoid81/libnetwork"
    34  	git checkout -q "$LIBNETWORK_COMMIT"
    35  	go build ${BUILD_MODE} -ldflags="$PROXY_LDFLAGS" -o ${PREFIX}/docker-proxy github.com/demonoid81/libnetwork/cmd/proxy
    36  }