-
Notifications
You must be signed in to change notification settings - Fork 34
/
Makefile
43 lines (34 loc) · 1.47 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
ENV := $(shell cat ../../.last_used_env || echo "not-set")
-include ../../.env.${ENV}
client := gcloud compute instances list --format='csv(name)' --project $(GCP_PROJECT_ID) | grep "client"
.PHONY: init
init:
brew install protobuf
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
.PHONY: generate
generate:
# You need to install protobuf (brew install protobuf) and following go packages: protoc-gen-go, protoc-gen-go-grpc
# https://grpc.io/docs/languages/go/quickstart/
@echo "Generating..."
@protoc --go_out=../shared/pkg/grpc/orchestrator/ --go_opt=paths=source_relative --go-grpc_out=../shared/pkg/grpc/orchestrator/ --go-grpc_opt=paths=source_relative orchestrator.proto
@echo "Done"
.PHONY: build
build:
@cp -r ../shared .shared/
@docker build --platform linux/amd64 --output=bin .
@rm -rf .shared/
.PHONY: build-local
build-local:
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o bin/orchestrator .
.PHONY: build-debug
build-debug:
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -race -gcflags=all="-N -l" -o bin/orchestrator .
.PHONY: upload
upload:
./upload.sh $(GCP_PROJECT_ID)
.PHONY: build-and-upload
build-and-upload: build upload
.PHONY: mock
mock:
sudo CONSUL_TOKEN=$(CONSUL_TOKEN) NODE_ID="test-client" go run -race -gcflags=all="-N -l" cmd/mock-sandbox/mock.go -template idnrwvs3vrde6hknozc0 -sandbox idnrwvs3vrde6hknozc0 -build "0f426192-e298-49d1-a779-2fecf990a522" -alive 20 -count 10