瀏覽代碼

Build containerd, runc, and proxy statically

These were originally static binaries in the first place, this changes
them back to that.

Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
Eli Uriegas 7 年之前
父節點
當前提交
63c7bb2463

+ 9 - 4
hack/dockerfile/install/containerd.installer

@@ -14,10 +14,15 @@ install_containerd() {
 
 	(
 
-		if [ "$1" == "static" ]; then
-			export BUILDTAGS='static_build netgo'
-			export EXTRA_FLAGS='-buildmod pie'
-			export EXTRA_LDFLAGS='-extldflags "-fno-PIC -static"'
+		export BUILDTAGS='static_build netgo'
+		export EXTRA_FLAGS='-buildmod pie'
+		export EXTRA_LDFLAGS='-extldflags "-fno-PIC -static"'
+
+		# Reset build flags to nothing if we want a dynbinary
+		if [ "$1" == "dynamic" ]; then
+			export BUILDTAGS=''
+			export EXTRA_FLAGS=''
+			export EXTRA_LDFLAGS=''
 		fi
 
 		make

+ 2 - 1
hack/dockerfile/install/proxy.installer

@@ -23,6 +23,7 @@ install_proxy() {
 
 install_proxy_dynamic() {
 	export PROXY_LDFLAGS="-linkmode=external" install_proxy
+	export BUILD_MODE="-buildmode=pie"
 	_install_proxy
 }
 
@@ -31,7 +32,7 @@ _install_proxy() {
 	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 -buildmode=pie -ldflags="$PROXY_LDFLAGS" -o ${PREFIX}/docker-proxy github.com/docker/libnetwork/cmd/proxy
+	go build $BUILD_MODE -ldflags="$PROXY_LDFLAGS" -o ${PREFIX}/docker-proxy github.com/docker/libnetwork/cmd/proxy
 }
 
 

+ 6 - 1
hack/dockerfile/install/runc.installer

@@ -11,7 +11,12 @@ install_runc() {
 	git clone https://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc"
 	cd "$GOPATH/src/github.com/opencontainers/runc"
 	git checkout -q "$RUNC_COMMIT"
-	make BUILDTAGS="$RUNC_BUILDTAGS" $1
+	if [ -z "$1" ]; then
+		target=static
+	else
+		target="$1"
+	fi
+	make BUILDTAGS="$RUNC_BUILDTAGS" "$target"
 	mkdir -p ${PREFIX}
 	cp runc ${PREFIX}/docker-runc
 }