-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
70 lines (56 loc) · 1.93 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
60
61
62
63
64
65
66
67
68
69
70
NOW = $(shell date -u '+%Y%m%d%I%M%S')
RELEASE_VERSION = v1.0.0
APP = app
SERVER_BIN = ./main/${APP}
RELEASE_ROOT = release
RELEASE_SERVER = release/${APP}
GIT_COUNT = $(shell git rev-list --all --count)
GIT_HASH = $(shell git rev-parse --short HEAD)
RELEASE_TAG = $(RELEASE_VERSION).$(GIT_COUNT).$(GIT_HASH)
all: start
.PHONY: build
build:
@go build -ldflags "-w -s -X main.VERSION=$(RELEASE_TAG)" -o $(SERVER_BIN) ./main
.PHONY: start
start:
@go run -ldflags "-X main.VERSION=$(RELEASE_TAG)" ./main/main.go web -c ./configs/config.toml -m ./configs/model.conf --menu ./configs/menu.yaml
.PHONY: swagger
swagger:
@hash swag > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
go install github.com/swaggo/swag/cmd/swag@latest; \
fi
@swag init --generalInfo ./main/main.go --output ./app/interfaces/api/swagger
.PHONY: wire
wire:
@hash wire > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
go install github.com/google/wire/cmd/wire@latest; \
fi
@wire gen ./injector
.PHONY: clean
clean:
rm -rf data release $(SERVER_BIN) data
.PHONY: pack
pack: build
rm -rf $(RELEASE_ROOT) && mkdir -p $(RELEASE_SERVER)
cp -r $(SERVER_BIN) configs $(RELEASE_SERVER)
cd $(RELEASE_ROOT) && tar -cvf $(APP).tar ${APP} && rm -rf ${APP}
.PHONY: lint
lint:
@hash golangci-lint > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.41.1; \
fi
golangci-lint run ./...
.PHONY: docker-push
docker-push:
time docker build --file ./Dockerfile --no-cache --tag seion/ddd-gin-admin .
docker login
docker push seion/ddd-gin-admin
.PHONY: skaffold-build
skaffold-build:
skaffold build --file-output output.json
.PHONY: skaffold-dev
skaffold-dev:
skaffold dev -v debug -p dev --wait-for-deletions=true --kube-context=minikube
.PHONY: tunnel-svc-with-minikube
tunnel-svc-with-minikube:
minikube service ddd-gin-admin-web --url -n ddd-gin-admin