Browse code

Add containerd static compile

Fixes #35349

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Michael Crosby authored on 2017/11/01 00:50:29
Showing 1 changed files
... ...
@@ -34,7 +34,21 @@ install_containerd() {
34 34
 	git checkout -q "$CONTAINERD_COMMIT"
35 35
 	(
36 36
 		export GOPATH
37
-		make $1
37
+		make
38
+	)
39
+	cp bin/containerd /usr/local/bin/docker-containerd
40
+	cp bin/containerd-shim /usr/local/bin/docker-containerd-shim
41
+	cp bin/ctr /usr/local/bin/docker-containerd-ctr
42
+}
43
+
44
+install_containerd_static() {
45
+	echo "Install containerd version $CONTAINERD_COMMIT"
46
+	git clone https://github.com/containerd/containerd.git "$GOPATH/src/github.com/containerd/containerd"
47
+	cd "$GOPATH/src/github.com/containerd/containerd"
48
+	git checkout -q "$CONTAINERD_COMMIT"
49
+	(
50
+		export GOPATH
51
+		make EXTRA_FLAGS="-buildmode pie" EXTRA_LDFLAGS="-extldflags \\\"-fno-PIC -static\\\""
38 52
 	)
39 53
 	cp bin/containerd /usr/local/bin/docker-containerd
40 54
 	cp bin/containerd-shim /usr/local/bin/docker-containerd-shim
... ...
@@ -106,7 +120,7 @@ do
106 106
 			;;
107 107
 
108 108
 		containerd)
109
-			install_containerd
109
+			install_containerd_static
110 110
 			;;
111 111
 
112 112
 		containerd-dynamic)