-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Makefile
95 lines (71 loc) · 1.78 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
SHELL := /bin/bash
GOCMD=go
GOTEST=$(GOCMD) test
GOCLEAN=$(GOCMD) clean
GOBUILD=$(GOCMD) build
GOINSTALL=$(GOCMD) install
BINARY_NAME=tyk
BINARY_LINUX=tyk
BUILD_PLATFORM=linux/amd64
TAGS=coprocess grpc goplugin
CONF=tyk.conf
TEST_REGEX=.
TEST_COUNT=1
BENCH_REGEX=.
BENCH_RUN=NONE
.PHONY: test
test:
$(GOTEST) -run=$(TEST_REGEX) -count=$(TEST_COUNT) ./...
# lint runs all local linters that must pass before pushing
.PHONY: lint lint-install lint-fast
lint:
task lint
.PHONY: bench
bench:
$(GOTEST) -run=$(BENCH_RUN) -bench=$(BENCH_REGEX) ./...
.PHONY: clean
clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)
.PHONY: dev
dev:
$(GOBUILD) -tags "$(TAGS)" -o $(BINARY_NAME) -v .
./$(BINARY_NAME) --conf $(CONF)
.PHONY: build
build:
$(GOBUILD) -tags "$(TAGS)" -o $(BINARY_NAME) -trimpath .
.PHONY: build-linux
build-linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -tags "$(TAGS)" -o $(BINARY_LINUX) -v .
.PHONY: install
install:
$(GOINSTALL) -tags "$(TAGS)"
.PHONY: db-start
db-start: redis-start mongo-start
.PHONY: db-stop
db-stop: redis-stop mongo-stop
# Docker start redis
.PHONY: redis-start
redis-start:
docker run -itd --rm --name redis -p 127.0.0.1:6379:6379 redis:4.0-alpine redis-server --appendonly yes
.PHONY: redis-stop
redis-stop:
docker stop redis
.PHONY: redis-cli
redis-cli:
docker exec -it redis redis-cli
# Docker start mongo
.PHONY: mongo-start
mongo-start:
docker run -itd --rm --name mongo -p 127.0.0.1:27017:27017 mongo:3.4-jessie
.PHONY: mongo-stop
mongo-stop:
docker stop mongo
.PHONY: mongo-shell
mongo-shell:
docker exec -it mongo mongo
.PHONY: docker docker-std
docker:
docker build --platform ${BUILD_PLATFORM} --rm -t internal/tyk-gateway .
docker-std: build
docker build --platform ${BUILD_PLATFORM} --no-cache -t internal/tyk-gateway:std -f ci/Dockerfile.std .