-
Notifications
You must be signed in to change notification settings - Fork 16
/
Makefile
48 lines (45 loc) · 1.22 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
# 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/dubbo2istio
DOCKER_TAG_E2E?=aeraki/dubbo2istio:`git log --format="%H" -n 1`
BINARY_NAME?=$(OUT)/dubbo2istio
BINARY_NAME_DARWIN?=$(BINARY_NAME)-darwin
MAIN_PATH_CONSUL_MCP=./cmd/dubbo2istio/main.go
build:
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)
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-build
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