From 63c7bb24637fdbfd905096ecc75b435ecefd31e9 Mon Sep 17 00:00:00 2001 From: Eli Uriegas Date: Wed, 7 Mar 2018 21:29:10 +0000 Subject: [PATCH 1/2] 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 --- hack/dockerfile/install/containerd.installer | 13 +++++++++---- hack/dockerfile/install/proxy.installer | 3 ++- hack/dockerfile/install/runc.installer | 7 ++++++- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/hack/dockerfile/install/containerd.installer b/hack/dockerfile/install/containerd.installer index 5731a6d560..1b42a48bf6 100755 --- a/hack/dockerfile/install/containerd.installer +++ b/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 diff --git a/hack/dockerfile/install/proxy.installer b/hack/dockerfile/install/proxy.installer index 598f67c3fb..ed9ea7cbce 100755 --- a/hack/dockerfile/install/proxy.installer +++ b/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 } diff --git a/hack/dockerfile/install/runc.installer b/hack/dockerfile/install/runc.installer index 8ec5efc44e..054f95d66a 100755 --- a/hack/dockerfile/install/runc.installer +++ b/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 } From 5e4885b9afb1de30133627ce751af2c0e7b72a4e Mon Sep 17 00:00:00 2001 From: Eli Uriegas Date: Wed, 7 Mar 2018 21:36:23 +0000 Subject: [PATCH 2/2] buildmod => buildmode There was a typo with the buildmode flag for containerd Signed-off-by: Eli Uriegas --- hack/dockerfile/install/containerd.installer | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hack/dockerfile/install/containerd.installer b/hack/dockerfile/install/containerd.installer index 1b42a48bf6..d6ab8371ae 100755 --- a/hack/dockerfile/install/containerd.installer +++ b/hack/dockerfile/install/containerd.installer @@ -15,7 +15,7 @@ install_containerd() { ( export BUILDTAGS='static_build netgo' - export EXTRA_FLAGS='-buildmod pie' + export EXTRA_FLAGS='-buildmode=pie' export EXTRA_LDFLAGS='-extldflags "-fno-PIC -static"' # Reset build flags to nothing if we want a dynbinary