-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (44 loc) · 1.06 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
.PHONY: clean critic security lint test build run
include .env
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: swag build
$(BUILD_DIR)/$(APP_NAME)
docker.run: docker.network swag docker.fiber
docker.network:
docker network inspect dev-network >/dev/null 2>&1 || \
docker network create -d bridge dev-network
docker.fiber.build:
docker build -t fiber .
docker.fiber: docker.fiber.build
docker run --rm -d \
--name cgapp-fiber \
--network dev-network \
-p 8000:8000 \
fiber
docker.redis:
docker run --rm -d \
--name cgapp-redis \
--network dev-network \
-p 6379:6379 \
redis
docker.stop: docker.stop.fiber
docker.stop.fiber:
docker stop cgapp-fiber
docker.stop.redis:
docker stop cgapp-redis
swag:
swag init