-
Notifications
You must be signed in to change notification settings - Fork 43
/
Makefile
41 lines (34 loc) · 1.16 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
# Go parameters
GOCMD=go
GOTEST=$(GOCMD) test
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOINSTALL=$(GOCMD) install
SVCS=chat match uploader user
VERSION=v0.0.0
.PHONY: proto doc
all: build test
test:
$(GOTEST) -gcflags=-l -v -cover -coverpkg=./... -coverprofile=cover.out ./...
build: dep doc
$(GOBUILD) -ldflags="-X github.com/minghsu0107/go-random-chat/cmd.Version=$(VERSION) -w -s" -o server ./randomchat.go
dep: wire
$(shell $(GOCMD) env GOPATH)/bin/wire ./internal/wire
proto:
protoc proto/*/*.proto --go_out=plugins=grpc:.
doc: swag
for svc in $(SVCS); do \
$(shell $(GOCMD) env GOPATH)/bin/swag init -g http.go -d pkg/$$svc -o docs/$$svc --instanceName $$svc --parseDependency --parseInternal; \
done
wire:
GO111MODULE=on $(GOINSTALL) github.com/google/wire/cmd/[email protected]
swag:
GO111MODULE=on $(GOINSTALL) github.com/swaggo/swag/cmd/[email protected]
docker: docker-api docker-web
docker-api:
@docker build -f ./build/Dockerfile.api --build-arg VERSION=$(VERSION) -t minghsu0107/random-chat-api:kafka .
docker-web:
@docker build -f ./build/Dockerfile.web --build-arg VERSION=$(VERSION) -t minghsu0107/random-chat-web:kafka .
clean:
$(GOCLEAN)
rm -f server