diff --git a/hack/dockerfile/install/containerd.installer b/hack/dockerfile/install/containerd.installer index dceae495c40c4..4be15a6abfb8b 100755 --- a/hack/dockerfile/install/containerd.installer +++ b/hack/dockerfile/install/containerd.installer @@ -14,7 +14,7 @@ install_containerd() { ( - export BUILDTAGS='static_build netgo' + export BUILDTAGS='netgo osusergo static_build' export EXTRA_FLAGS='-buildmode=pie' export EXTRA_LDFLAGS='-extldflags "-fno-PIC -static"' diff --git a/hack/make.sh b/hack/make.sh index cd9232a4a5c40..bc0c2a39d0d06 100755 --- a/hack/make.sh +++ b/hack/make.sh @@ -145,7 +145,7 @@ LDFLAGS_STATIC='' EXTLDFLAGS_STATIC='-static' # ORIG_BUILDFLAGS is necessary for the cross target which cannot always build # with options like -race. -ORIG_BUILDFLAGS=( -tags "autogen netgo static_build $DOCKER_BUILDTAGS" -installsuffix netgo ) +ORIG_BUILDFLAGS=( -tags "autogen netgo osusergo static_build $DOCKER_BUILDTAGS" -installsuffix netgo ) # see https://github.com/golang/go/issues/9369#issuecomment-69864440 for why -installsuffix is necessary here # When $DOCKER_INCREMENTAL_BINARY is set in the environment, enable incremental diff --git a/hack/make/dynbinary-daemon b/hack/make/dynbinary-daemon index d1c0070e62efe..c712bfefc281b 100644 --- a/hack/make/dynbinary-daemon +++ b/hack/make/dynbinary-daemon @@ -5,6 +5,7 @@ set -e export IAMSTATIC='false' export LDFLAGS_STATIC_DOCKER='' export BUILDFLAGS=( "${BUILDFLAGS[@]/netgo /}" ) # disable netgo, since we don't need it for a dynamic binary + export BUILDFLAGS=( "${BUILDFLAGS[@]/osusergo /}" ) # ditto for osusergo export BUILDFLAGS=( "${BUILDFLAGS[@]/static_build /}" ) # we're not building a "static" binary here source "${MAKEDIR}/.binary" )