-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
59 lines (53 loc) · 1.44 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Go parameters
GOCMD?=go
GOBUILD?=$(GOCMD) build
GOCLEAN?=$(GOCMD) clean
GOTEST?=$(GOCMD) test
GOGET?=$(GOCMD) get
GOBIN?=$(GOPATH)/bin
# Build parameters
OUT?=./out
DOCKER_TMP?=$(OUT)/docker_temp/
#DOCKER_TAG?=aeraki/eureka2istio:latest
DOCKER_TAG?=huanghuangzym/eureka2istio:latest
#DOCKER_TAG_E2E?=aeraki/eureka2istio:`git log --format="%H" -n 1`
DOCKER_TAG_E2E?=huanghuangzym/eureka2istio:`git log --format="%H" -n 1`
BINARY_NAME?=$(OUT)/eureka2istio
BINARY_NAME_DARWIN?=$(BINARY_NAME)-darwin
MAIN_PATH_CONSUL_MCP=./cmd/eureka2istio/main.go
# Run go fmt against code
fmt:
go fmt ./...
# Run go vet against code
vet:
go vet ./...
build: fmt
CGO_ENABLED=0 GOOS=linux $(GOBUILD) -o $(BINARY_NAME) $(MAIN_PATH_CONSUL_MCP)
build-mac:
CGO_ENABLED=0 GOOS=darwin $(GOBUILD) -o $(BINARY_NAME_DARWIN) $(MAIN_PATH_CONSUL_MCP)
docker-build: build
rm -rf $(DOCKER_TMP)
mkdir $(DOCKER_TMP)
cp ./docker/Dockerfile $(DOCKER_TMP)
cp $(BINARY_NAME) $(DOCKER_TMP)
docker build -t $(DOCKER_TAG) $(DOCKER_TMP) --load
rm -rf $(DOCKER_TMP)
docker-build-e2e: build
rm -rf $(DOCKER_TMP)
mkdir $(DOCKER_TMP)
cp ./docker/Dockerfile $(DOCKER_TMP)
cp $(BINARY_NAME) $(DOCKER_TMP)
docker build -t $(DOCKER_TAG_E2E) $(DOCKER_TMP)
docker-push:
docker push $(DOCKER_TAG)
style-check:
gofmt -l -d ./
goimports -l -d ./
lint:
golint ./...
golangci-lint run -v --tests="false"
test:
go test --race ./...
clean:
rm -rf $(OUT)
.PHONY: build docker-build docker-push clean