-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
executable file
·33 lines (28 loc) · 1.02 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
# Variables
SERVICE=api-gateway
IMG_HUB?=registry.test.io/test
TAG?=latest
# Version information
VERSION=1.0.0
REVISION=${shell git rev-parse --short HEAD}
RELEASE=production
BUILD_HASH=${shell git rev-parse HEAD}
BUILD_TIME=${shell date "+%Y-%m-%d@%H:%M:%SZ%z"}
LD_FLAGS:=-X main.Version=$(VERSION) -X main.Revision=$(REVISION) -X main.Release=$(RELEASE) -X main.BuildHash=$(BUILD_HASH) -X main.BuildTime=$(BUILD_TIME)
run:prepare build
@-docker service rm $(SERVICE)
@docker service create --name $(SERVICE) --network devel -p 8080:8080 -e GRPC_GO_LOG_SEVERITY_LEVEL=INFO $(IMG_HUB)/$(SERVICE):$(TAG)
cd example/echo && make run
cd example/helloworld && make run
prepare:
@go get google.golang.org/grpc
@go get github.com/gogo/protobuf/protoc-gen-gogofast
@-docker swarm init
@-docker network create --driver=overlay devel
build:
@go build -ldflags="$(LD_FLAGS)" -o bundles/$(SERVICE) cmd/main.go
docker build -t $(IMG_HUB)/$(SERVICE):$(TAG) .
test:
@go test -cover ./...
# PHONY
.PHONY : test test-integration generate fmt