From cad10c54f287a673623c148a9ab015b1f4071b5d Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Mon, 15 Mar 2021 23:10:23 -0400 Subject: [PATCH] k3s: add additional build tags To more closely align with the rancher/upstream build, we add additional tags to the build. To make them easier to manage, we also introduce a variable and use it in the go build line. Signed-off-by: Bruce Ashfield --- recipes-containers/k3s/k3s_git.bb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/recipes-containers/k3s/k3s_git.bb b/recipes-containers/k3s/k3s_git.bb index 6c11f9c2..28d6ce0c 100644 --- a/recipes-containers/k3s/k3s_git.bb +++ b/recipes-containers/k3s/k3s_git.bb @@ -40,8 +40,12 @@ do_compile() { export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go" export CGO_ENABLED="1" export GOFLAGS="-mod=vendor" + + TAGS="static_build ctrd no_btrfs netcgo osusergo providerless" + cd ${S}/src/import - ${GO} build -tags providerless -ldflags "${GO_BUILD_LDFLAGS}" -o ./dist/artifacts/k3s ./cmd/server/main.go + ${GO} build -tags "$TAGS" -ldflags "${GO_BUILD_LDFLAGS} -w -s" -o ./dist/artifacts/k3s ./cmd/server/main.go + # Use UPX if it is enabled (and thus exists) to compress binary if command -v upx > /dev/null 2>&1; then upx -9 ./dist/artifacts/k3s