forked from mpolden/echoip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
43 lines (30 loc) · 965 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
DOCKER_IMAGE := mpolden/echoip
OS := $(shell uname)
ifeq ($(OS),Linux)
TAR_OPTS := --wildcards
endif
all: deps lint test install
deps:
go get ./...
test: deps
go test ./...
vet: deps
go vet ./...
check-fmt:
bash -c "diff --line-format='%L' <(echo -n) <(gofmt -d -s .)"
lint: check-fmt vet
install: deps
go install ./...
databases := GeoLite2-City GeoLite2-Country
$(databases):
mkdir -p data
curl -fsSL -m 30 https://geolite.maxmind.com/download/geoip/database/[email protected] | tar $(TAR_OPTS) --strip-components=1 -C $(CURDIR)/data -xzf - '*.mmdb'
test ! -f data/GeoLite2-City.mmdb || mv data/GeoLite2-City.mmdb data/city.mmdb
test ! -f data/GeoLite2-Country.mmdb || mv data/GeoLite2-Country.mmdb data/country.mmdb
geoip-download: $(databases)
docker-build:
docker build -t $(DOCKER_IMAGE) .
docker-login:
@echo "$(DOCKER_PASSWORD)" | docker login -u "$(DOCKER_USERNAME)" --password-stdin
docker-push: docker-login
docker push $(DOCKER_IMAGE)