Skip to content

added geoip-download to docker-pushx and made GEOIP_LICENSE_KEY option #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,17 @@ install:
databases := GeoLite2-City GeoLite2-Country GeoLite2-ASN

$(databases):
ifndef GEOIP_LICENSE_KEY
$(error GEOIP_LICENSE_KEY must be set. Please see https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-geolite2-databases/)
endif

mkdir -p data

ifdef GEOIP_LICENSE_KEY
@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'
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
test ! -f data/GeoLite2-ASN.mmdb || mv data/GeoLite2-ASN.mmdb data/asn.mmdb
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/)
else
cp GeoLite2-City.mmdb data/city.mmdb
cp GeoLite2-Country.mmdb data/country.mmdb
cp GeoLite2-ASN.mmdb data/asn.mmdb
endif

geoip-download: $(databases)

Expand All @@ -60,7 +63,7 @@ docker-test:
docker-push: docker-test docker-login
$(DOCKER) push $(DOCKER_IMAGE)

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

xinstall:
Expand Down
Loading