Build CLI only for host platform (#884)

* Build CLI only for host platform

Signed-off-by: Alena Varkockova <varkockova.a@gmail.com>

* Changes after code review

Signed-off-by: Alena Varkockova <varkockova.a@gmail.com>
This commit is contained in:
Alena Varkockova 2018-06-18 19:34:56 +02:00 committed by Kevin Lingerfelt
parent fdb0b7f63f
commit 6bb8b1328f
3 changed files with 38 additions and 1 deletions

View File

@ -206,6 +206,17 @@ In development you can run:
bin/go-run cli check
```
### Building CLI for development
When Conduit's CLI is built using `bin/docker-build` it always creates binaries for all three platforms.
For local development and fast edit-build-test cycle you might want to avoid that. For those situations
you can use the fast-build option, that will skip the docker build altogether and will build CLI
locally using `go build`.
```bash
bin/fast-build
```
### Running the control plane for development
Conduit's control plane is composed of several Go microservices. You can run

View File

@ -12,7 +12,9 @@ bindir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
$bindir/docker-build-controller
$bindir/docker-build-web
$bindir/docker-build-proxy-init
$bindir/docker-build-cli-bin
if [ $CONDUIT_SKIP_CLI_CONTAINER -ne 1 ]; then
$bindir/docker-build-cli-bin
fi
$bindir/docker-build-grafana
$bindir/docker-build-proxy

24
bin/fast-build Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
set -eu
cd "$(pwd -P)"
# 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
CONDUIT_SKIP_CLI_CONTAINER=1 bin/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
./bin/dep ensure -vendor-only -v
target="$rootdir/target/cli/${host_platform}/conduit"
CGO_ENABLED=0 go build -installsuffix cgo -o $target -ldflags "-s -w -X github.com/runconduit/conduit/pkg/version.Version=$($bindir/root-tag)" ./cli
echo "$target"