-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
54 lines (43 loc) · 1.33 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
APPNAME = cardbill
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
TAG = v0.0.01-test
NAMESPACE = app
PWD = $(shell pwd)
GOPROXY = https://goproxy.cn
start:
$(GOBUILD) -v
$(BIN)/$(APPNAME) & echo $$! > $(PID)
restart:
@echo restart the app...
@kill `cat $(PID)` || true
$(BIN)/$(APPNAME) & 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 cardbill -v ./cmd/server/service.go
docker build --rm -t $(APPNAME):$(TAG) .
docker-run:
docker run -it --rm -p 8080:8080 -v $(PWD)/app.cfg:/etc/cardbill/app.cfg $(APPNAME):$(TAG)
push:
docker image tag $(APPNAME):$(TAG) $(HUB_ADDR)/$(NAMESPACE)/$(APPNAME):$(TAG)
docker push $(HUB_ADDR)/$(NAMESPACE)/$(APPNAME):$(TAG)
run:
GO111MODULE=on GOPROXY=$(GOPROXY) $(GORUN) ./main.go -http-addr :8080 -config-file ./app.cfg
client-init:
GO111MODULE=on $(GORUN) ./cmd/client/client.go -config-file ./app.cfg
get:
GO111MODULE=on $(GOGET) $(shell v='$(FULL_VERSION)'; echo "$${v%.*}")