From e3e28d144dd2b74591d57dad3a3021fe99701d94 Mon Sep 17 00:00:00 2001 From: Martin Petkov Date: Mon, 8 Feb 2021 16:18:04 -0500 Subject: [PATCH] Build binaries statically (#786) This lets them run in the Alpine-based containers used in the CI/CD templates. --- build/build-include.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/build-include.sh b/build/build-include.sh index c9ede4ee8..804d66084 100755 --- a/build/build-include.sh +++ b/build/build-include.sh @@ -54,7 +54,7 @@ function build_binaries() { bin_name="$(basename ${build_dir})" bin="${bin_name}_${VERSION}_${OS}-${ARCH}" echo "Building ${OUTPUT_DIR}/${bin}" - env GOOS="${OS}" GOARCH="${ARCH}" go build -ldflags="-X 'github.com/GoogleCloudPlatform/healthcare-data-protection-suite/cmd.Version=${VERSION}' -X 'github.com/GoogleCloudPlatform/healthcare-data-protection-suite/cmd.BuildTime=${BUILD_TIME}'" -o "${OUTPUT_DIR}/${bin}" "${build_dir}" + env CGO_ENABLED=0 GOOS="${OS}" GOARCH="${ARCH}" go build -ldflags="-extldflags '-static' -X 'github.com/GoogleCloudPlatform/healthcare-data-protection-suite/cmd.Version=${VERSION}' -X 'github.com/GoogleCloudPlatform/healthcare-data-protection-suite/cmd.BuildTime=${BUILD_TIME}'" -o "${OUTPUT_DIR}/${bin}" "${build_dir}" done done done