-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
32 lines (26 loc) · 950 Bytes
/
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
GOPATH:=$(shell go env GOPATH)
.PHONY: proto
proto:
protoc --proto_path=.:$$GOPATH/src \
--go_out=:. \
--go-grpc_out=:. \
--grpc-gateway_out=logtostderr=true,grpc_api_configuration=example/proto/gateway.yaml:. \
--openapiv2_out=grpc_api_configuration=example/proto/gateway.yaml:. \
--hb-grpc-gateway_out=logtostderr=true,grpc_api_configuration=example/proto/gateway.yaml:. \
--hb-grpc_out=plugins=desc+registry:. \
example/proto/service.proto
.PHONY: test
test:
go test -race -cover -v ./...
.PHONY: run
run:
go run cmd/main.go --grpc_registry=etcd --log_level=info --debug -e
.PHONY: build
build:
CGO_ENABLED=0 GOARCH=amd64 go build -a -installsuffix cgo -ldflags '-w' -o ./bin/gateway cmd/main.go
.PHONY: build_linux
build_linux:
GOOS=linux CGO_ENABLED=0 GOARCH=amd64 go build -a -installsuffix cgo -ldflags '-w' -o ./bin/linux/gateway cmd/main.go
.PHONY: docker
docker: build_linux
docker build . -t $(tag)