forked from Qihoo360/wayne
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
66 lines (48 loc) · 2.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
.PHONY: run-backend run-worker run-frontend syncdb release
MAKEFLAGS += --warn-undefined-variables
# Build variables
REGISTRY_URI :=360cloud
RELEASE_VERSION :=$(shell git describe --always --tags)
UI_BUILD_VERSION :=v1.0.1
SERVER_BUILD_VERSION :=v1.0.1
release: build-backend-image build-frontend-image push-image
update-version:
./hack/updateversion.sh
# run module
run-backend:
export GO111MODULE=on && export GOPROXY=https://goproxy.io && cd src/backend/ && bee run -main=./main.go -runargs="apiserver"
run-worker:
cd src/backend/ && bee run -main=./main.go -runargs="worker -t AuditWorker -c 2"
run-webhook:
cd src/backend/ && bee run -main=./main.go -runargs="worker -t WebhookWorker -c 2"
run-frontend:
cd src/frontend/ && npm start
# dev
syncdb:
go run src/backend/database/syncdb.go orm syncdb
sqlall:
go run src/backend/database/syncdb.go orm sqlall > _dev/wayne.sql
initdata:
go run src/backend/database/generatedata/main.go > _dev/wayne-data.sql
swagger-openapi:
cd src/backend && swagger generate spec -o ./swagger/openapi.swagger.json
# release, requiring Docker 17.05 or higher on the daemon and client
build-backend-image:
@echo "version: $(RELEASE_VERSION)"
docker build --no-cache -t $(REGISTRY_URI)/wayne-backend:$(RELEASE_VERSION) -f Dockerfile.backend .
build-frontend-image:
@echo "version: $(RELEASE_VERSION)"
docker build --no-cache -t $(REGISTRY_URI)/wayne-frontend:$(RELEASE_VERSION) -f Dockerfile.frontend .
push-image:
docker tag $(REGISTRY_URI)/wayne-backend:$(RELEASE_VERSION) $(REGISTRY_URI)/wayne-backend:latest
docker push $(REGISTRY_URI)/wayne-backend:$(RELEASE_VERSION)
docker push $(REGISTRY_URI)/wayne-backend:latest
docker tag $(REGISTRY_URI)/wayne-frontend:$(RELEASE_VERSION) $(REGISTRY_URI)/wayne-frontend:latest
docker push $(REGISTRY_URI)/wayne-frontend:$(RELEASE_VERSION)
docker push $(REGISTRY_URI)/wayne-frontend:latest
## server builder image
build-server-image:
cd hack/build/server && docker build --no-cache -t $(REGISTRY_URI)/wayne-server-builder:$(SERVER_BUILD_VERSION) .
## ui builder image
build-ui-image:
docker build -f hack/build/ui/Dockerfile -t $(REGISTRY_URI)/wayne-ui-builder:$(UI_BUILD_VERSION) .