This repository has been archived by the owner on Sep 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
79 lines (59 loc) · 1.84 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
71
72
73
74
75
76
77
78
79
PROTOC = protoc
GO111MODULE = on
DOCKER_APISERVER_DOCKERFILE = Dockerfile-api
DOCKER_YAMLER_DOCKERFILE = Dockerfile-yamler
DOCKER_AUTHSERVER_DOCKERFILE = Dockerfile-auth
DOCKER_APISERVER_IMAGE = modokipaas/modoki-k8s
DOCKER_YAMLER_IMAGE = modokipaas/modoki-yamler
DOCKER_AUTHSERVER_IMAGE = modokipaas/modoki-auth
DOCKER_DOCKERFILE=$(DOCKER_APISERVER_DOCKERFILE)
DOCKER_IMAGE=$(DOCKER_APISERVER_IMAGE)
DOCKER_BUILDKIT = 1
.DEFAULT_GOAL := build
.PHONY: install_dependencies
install_dependencies:
curl -s "https://raw.githubusercontent.com/\
kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
.PHONY: apiserver
apiserver:
go build -o modoki-apiserver $(wildcard ./apiserver/*.go)
.PHONY: authserver
authserver:
go build -o modoki-authserver $(wildcard ./authserver/*.go)
.PHONY: yamler
yamler:
go build -o modoki-yamler $(wildcard ./yamler/*.go)
build: apiserver authserver yamler
.PHONY: all
all: build test docker-all
define docker
docker build -t $1 -f $2 .
endef
define docker-push
if [ "$(CIRCLE_BRANCH)" = "master" ]; then\
docker push $1;\
fi
docker tag $1 $1:$(CIRCLE_SHA1)
docker push $1:$(CIRCLE_SHA1)
endef
.PHONY: docker-api docker-auth docker-yamler
docker-api:
@$(call docker,$(DOCKER_APISERVER_IMAGE),$(DOCKER_APISERVER_DOCKERFILE))
@$(call docker-push,$(DOCKER_APISERVER_IMAGE))
docker-auth:
@$(call docker,$(DOCKER_AUTHSERVER_IMAGE),$(DOCKER_AUTHSERVER_DOCKERFILE))
@$(call docker-push,$(DOCKER_AUTHSERVER_IMAGE))
docker-yamler:
@$(call docker,$(DOCKER_YAMLER_IMAGE),$(DOCKER_YAMLER_DOCKERFILE))
@$(call docker-push,$(DOCKER_YAMLER_IMAGE))
.PHONY: docker-all
docker-all: docker-api docker-auth docker-yamler
.PHONY: test
test:
go test -race -tags use_external_db -v ./...
.PHONY: generate
generate: clean
cd ./design && $(PROTOC) --go_out=plugins=grpc:../api *.proto
.PHONY: clean
clean:
rm ./api/*.pb.go || true