-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
65 lines (53 loc) · 1.69 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
DATE = $(shell date --iso=seconds)
GITHASH = $(shell git rev-parse --short HEAD)
VERSION = "1.0.0"
SOURCES = inmemory.go redis.go storage.go helper.go proxy.go queue.go visited.go crawler.go parser.go main.go
test:
go test
test-with-race:
go test -race
image: $(SOURCES)
docker build . --file Dockerfile --tag crwl:$(GITHASH) \
--build-arg GITHASH=$(GITHASH) \
--build-arg VERSION=$(VERSION) \
--build-arg BUILDAT=$(DATE)
docker build . --file Dockerfile --tag crwl:latest \
--build-arg GITHASH=$(GITHASH) \
--build-arg VERSION=$(VERSION) \
--build-arg BUILDAT=$(DATE)
build: test
go build -o bin/crwl \
-ldflags "-X main.version=$(VERSION) -X 'main.buildat=$(DATE)' -X 'main.githash=$(GITHASH)'"
build-with-race: test-with-race
go build -race -o bin/crwl \
-ldflags "-X main.version=$(VERSION) -X 'main.buildat=$(DATE)' -X 'main.githash=$(GITHASH)'" \
${SOURCES}
run: build
bin/crwl -domain habr.com \
-use-redis \
-statsd-addr 192.168.1.140:8125 \
-store-path /tmp/crwl \
-redis-addr 192.168.1.140:6379 \
-redis-base 0 \
-redis-pass ddlmaster
run-with-race: build-with-race
bin/crwl -domain habr.com \
-use-redis \
-statsd-addr 192.168.1.140:8125 \
-store-path /tmp/crwl \
-redis-addr 192.168.1.140:6379 \
-redis-base 0 \
-redis-pass ddlmaster
image-nas-repo: image
docker tag crwl:$(GITHASH) 192.168.1.140:6088/crwl:$(GITHASH)
docker push 192.168.1.140:6088/crwl:$(GITHASH)
run-local: build
bin/crwl -domain habr.com \
-use-internal-cache \
-use-internal-queue \
-statsd-addr 192.168.1.140:8125 \
-store-path /tmp/crwl \
-redis-addr 192.168.1.140:6379 \
-redis-base 0 \
-redis-pass ddlmaster \
-max-workers 2