-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
51 lines (43 loc) · 1.72 KB
/
Makefile
File metadata and controls
51 lines (43 loc) · 1.72 KB
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
GH_CI_USER:=$(GH_CI_USER)
GH_CI_TOKEN:=$(GH_CI_TOKEN)
GL_CI_USER:=$(GL_CI_USER)
GL_CI_TOKEN:=$(GL_CI_TOKEN)
.PHONY: settoken
settoken:
ifneq ('$(GH_CI_TOKEN)','')
@git config --global url."https://$(GH_CI_USER):$(GH_CI_TOKEN)@github.com/tespkg".insteadOf "https://github.com/tespkg"
endif
ifneq ('$(GL_CI_TOKEN)','')
@git config --global url."https://$(GL_CI_USER):$(GL_CI_TOKEN)@gitlab.com/".insteadOf "https://gitlab.com/"
endif
.PHONY: run
run:
@./bin/bytes-be staff -c ./contrib/server.yaml
.PHONY: swag
swag:
./bin/swag init -g main.go
.PHONY: build-with-vendor
build-with-vendor:
@if test -d "./vendor/"; then echo "checking vendor folder... [OK]"; else echo "checking vendor folder... [FAILED]"; echo "run go mod vendor first"; exit 2; fi;
@mkdir -p bin
@echo "start building bytes-be..."
@GOPRIVATE=github.com/tespkg/*,gitlab.com/target-digital-transformation/*,tespkg.in/* go build -mod vendor -o bin/bytes-be github.com/tespkg/bytes-be
@echo "building done"
.PHONY: build
build: settoken
@mkdir -p bin
@echo "start building bytes-be..."
@go mod tidy
@GOPRIVATE=github.com/tespkg/*,gitlab.com/target-digital-transformation/*,tespkg.in/* go build -o bin/bytes-be github.com/tespkg/bytes-be
@echo "building done"
.PHONY: build-image
build-image: settoken
@echo "start building docker image"
@docker build -t local/bytes-be -f ./Dockerfile .
@echo "building done"
.PHONY: build-image-with-vendor
build-image-with-vendor: settoken
@if test -d "./vendor/"; then echo "checking vendor folder... [OK]"; else echo "checking vendor folder... [FAILED]"; echo "run go mod vendor first"; exit 2; fi;
@echo "start building docker image with vendor"
@docker build -t local/bytes-be -f ./docker/vendor.Dockerfile .
@echo "building done"