-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
47 lines (33 loc) · 867 Bytes
/
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
.PHONY: clean critic security lint test build run
APP_NAME = apiserver
BUILD_DIR = $(PWD)/build
clean:
rm -rf ./build
critic:
gocritic check -enableAll ./...
security:
gosec ./...
lint:
golangci-lint run ./...
test: clean critic security lint
go test -v -timeout 30s -coverprofile=cover.out -cover ./...
go tool cover -func=cover.out
build: test
CGO_ENABLED=0 go build -ldflags="-w -s" -o $(BUILD_DIR)/$(APP_NAME) main.go
run: build
$(BUILD_DIR)/$(APP_NAME)
docker.run: docker.network docker.chi
docker.network:
docker network inspect dev-network >/dev/null 2>&1 || \
docker network create -d bridge dev-network
docker.chi.build:
docker build -t chi .
docker.chi: docker.chi.build
docker run --rm -d \
--name cgapp-chi \
--network dev-network \
-p 5000:5000 \
chi
docker.stop: docker.stop.chi
docker.stop.chi:
docker stop cgapp-chi