-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (49 loc) · 1.04 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
DC=docker-compose
IG=svc-protocol-api:latest
GO_SRC_DIRS := $(shell \
find . -name "*.go" -not -path "./vendor/*" | \
xargs -I {} dirname {} | \
uniq)
GO_TEST_DIRS := $(shell \
find . -name "*_test.go" -not -path "./vendor/*" | \
xargs -I {} dirname {} | \
uniq)
.PHONY: all build compose-down compose-up deps run test watch
all: build
b: build
cd: compose-down
cu: compose-up
d: deps
r: run
w: watch
build:
@echo "building [api]..."
@go build -o bin/api main.go
deploy:
@echo "Deploying new version..."
git fetch
git merge origin/master
go build -o bin/api main.go
sudo service protocol-api restart
compose-down:
-docker stop protocol-api_protocol-api_1
-docker rm protocol-api_protocol-api_1
-docker stop protocol-api_postgres_1
-docker rm protocol-api_postgres_1
-docker stop protocol-api_redis_1
-docker rm protocol-api_redis_1
compose-up:
@$(DC) -f $(DC).yml up --build
deps:
@go get -u ./...
@go mod download
@go mod tidy
@go mod vendor
lint:
@golint ./...
run:
@PORT=8000 ./bin/api
test:
@go test -v ./...
watch:
@air