1
0
mirror of https://github.com/docker/cli.git synced 2026-01-13 18:22:35 +03:00

Merge pull request #3490 from thaJeztah/fix_osusergo

scripts/build: make sure osusergo is set for static with CGO enabled
This commit is contained in:
Sebastiaan van Stijn
2022-03-26 17:00:05 +01:00
committed by GitHub

View File

@@ -73,6 +73,10 @@ fi
if [ "$CGO_ENABLED" = "1" ] && [ "$GO_LINKMODE" = "static" ] && [ "$(go env GOOS)" = "linux" ]; then
LDFLAGS="$LDFLAGS -extldflags -static"
fi
if [ "$CGO_ENABLED" = "1" ] && [ "$GO_LINKMODE" = "static" ]; then
# compiling statically with CGO enabled requires osusergo to be set.
GO_BUILDTAGS="$GO_BUILDTAGS osusergo"
fi
if [ -n "$GO_STRIP" ]; then
LDFLAGS="$LDFLAGS -s"
fi