-
Notifications
You must be signed in to change notification settings - Fork 37
/
Makefile
49 lines (40 loc) · 1.14 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
APPNAME = shorter
BIN = $(GOPATH)/bin
GOCMD = /usr/local/go/bin/go
GOBUILD = $(GOCMD) build
GOINSTALL = $(GOCMD) install
GOCLEAN = $(GOCMD) clean
GOTEST = $(GOCMD) test
GOGET = $(GOCMD) get
GORUN = $(GOCMD) run
BINARY_UNIX = $(BIN)_unix
PID = .pid
HUB_ADDR = hub.kpaas.nsini.com
DOCKER_USER =
DOCKER_PWD =
TAG = v0.1
NAMESPACE = kpaas
PWD = $(shell pwd)
start:
$(GOINSTALL) -v
$(BIN)/$(APPNAME) -http-addr :8080 & echo $$! > $(PID)
restart:
@echo restart the app...
@kill `cat $(PID)` || true
$(BIN)/$(APPNAME) -http-addr :8080 & echo $$! > $(PID)
stop:
@kill `cat $(PID)` || true
build-linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINARY_UNIX) -v
login:
docker login -u $(DOCKER_USER) -p $(DOCKER_PWD) $(HUB_ADDR)
build:
# CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -o kplcloud -v ./main.go
docker build --rm -t $(APPNAME):$(TAG) .
docker-run:
docker run -it --rm -p http-addr 8080:8080 $(APPNAME):$(TAG)
push:
docker image tag $(APPNAME):$(TAG) $(HUB_ADDR)/$(NAMESPACE)/$(APPNAME):$(TAG)
docker push $(HUB_ADDR)/$(NAMESPACE)/$(APPNAME):$(TAG)
run:
GO111MODULE=on $(GORUN) ./cmd/main.go -http-addr :8080 -grpc-addr :8082