Skip to content

Commit 435f0c1

Browse files
authored
Merge pull request #6 from leafcloudhq/fix-geoip-download
added geoip-download to docker-pushx and made GEOIP_LICENSE_KEY option
2 parents 16fe6dd + a2080e7 commit 435f0c1

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

Makefile

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,17 @@ install:
2727
databases := GeoLite2-City GeoLite2-Country GeoLite2-ASN
2828

2929
$(databases):
30-
ifndef GEOIP_LICENSE_KEY
31-
$(error GEOIP_LICENSE_KEY must be set. Please see https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-geolite2-databases/)
32-
endif
30+
3331
mkdir -p data
32+
33+
ifdef GEOIP_LICENSE_KEY
3434
@curl -fsSL -m 30 "https://download.maxmind.com/app/geoip_download?edition_id=$@&license_key=$(GEOIP_LICENSE_KEY)&suffix=tar.gz" | tar $(TAR_OPTS) --strip-components=1 -C $(CURDIR)/data -xzf - '*.mmdb'
35-
test ! -f data/GeoLite2-City.mmdb || mv data/GeoLite2-City.mmdb data/city.mmdb
36-
test ! -f data/GeoLite2-Country.mmdb || mv data/GeoLite2-Country.mmdb data/country.mmdb
37-
test ! -f data/GeoLite2-ASN.mmdb || mv data/GeoLite2-ASN.mmdb data/asn.mmdb
35+
test ! -f data/city.mmdb || $(error Failed to download GEOIP databases, GEOIP_LICENSE_KEY is probably wrong. Please see https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-geolite2-databases/)
36+
else
37+
cp GeoLite2-City.mmdb data/city.mmdb
38+
cp GeoLite2-Country.mmdb data/country.mmdb
39+
cp GeoLite2-ASN.mmdb data/asn.mmdb
40+
endif
3841

3942
geoip-download: $(databases)
4043

@@ -60,7 +63,7 @@ docker-test:
6063
docker-push: docker-test docker-login
6164
$(DOCKER) push $(DOCKER_IMAGE)
6265

63-
docker-pushx: docker-multiarch-builder docker-test docker-login
66+
docker-pushx: geoip-download docker-multiarch-builder docker-test docker-login
6467
$(DOCKER) buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t $(DOCKER_IMAGE) --push .
6568

6669
xinstall:

0 commit comments

Comments
 (0)