linkerd2/bin/fast-build

30 lines
835 B
Bash
Executable File

#!/bin/bash
set -eu
# Builds CLI binary for current platform only and outside docker to speed up things. Suitable for local development.
bindir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
rootdir="$( cd $bindir/.. && pwd )"
. $bindir/_tag.sh
LINKERD_SKIP_CLI_CONTAINER=1 $bindir/docker-build
current_platform=$(uname)
host_platform="windows"
if [ "${current_platform}" = 'Darwin' ]; then
host_platform="darwin"
elif [ "${current_platform}" = 'Linux' ]; then
host_platform="linux"
fi
(
cd $rootdir
cd "$(pwd -P)"
if [ -z "${LINKERD_SKIP_DEP:-}" ]; then
$bindir/dep ensure -vendor-only -v
fi
target="target/cli/${host_platform}/linkerd"
CGO_ENABLED=0 go build -o $target -ldflags "-s -w -X github.com/linkerd/linkerd2/pkg/version.Version=$($bindir/root-tag)" ./cli
echo "$target"
)