mirror of https://github.com/mpolden/echoip
Allow providing GeoIP license key in Dockerfile
This commit is contained in:
parent
2fe2f078e2
commit
e31edadbb1
|
@ -4,13 +4,19 @@ WORKDIR /go/src/github.com/mpolden/echoip
|
||||||
COPY . .
|
COPY . .
|
||||||
# Must build without cgo because libc is unavailable in runtime image
|
# Must build without cgo because libc is unavailable in runtime image
|
||||||
ENV GO111MODULE=on CGO_ENABLED=0
|
ENV GO111MODULE=on CGO_ENABLED=0
|
||||||
RUN make
|
ARG GEOIP_LICENSE_KEY
|
||||||
|
RUN if [ ${GEOIP_LICENSE_KEY:-} ]; then \
|
||||||
|
make all geoip-download ;\
|
||||||
|
else \
|
||||||
|
make all ;\
|
||||||
|
fi
|
||||||
|
|
||||||
# Run
|
# Run
|
||||||
FROM scratch
|
FROM scratch
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
COPY --from=build \
|
COPY --from=build \
|
||||||
/go/bin/echoip \
|
/go/bin/echoip \
|
||||||
|
/go/src/github.com/mpolden/echoip/data/ \
|
||||||
/go/src/github.com/mpolden/echoip/index.html \
|
/go/src/github.com/mpolden/echoip/index.html \
|
||||||
/opt/echoip/
|
/opt/echoip/
|
||||||
WORKDIR /opt/echoip
|
WORKDIR /opt/echoip
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -36,7 +36,7 @@ endif
|
||||||
geoip-download: $(databases)
|
geoip-download: $(databases)
|
||||||
|
|
||||||
docker-build:
|
docker-build:
|
||||||
$(DOCKER) build -t $(DOCKER_IMAGE) .
|
$(DOCKER) build -t $(DOCKER_IMAGE) . --build-arg GEOIP_LICENSE_KEY
|
||||||
|
|
||||||
docker-login:
|
docker-login:
|
||||||
@echo "$(DOCKER_PASSWORD)" | $(DOCKER) login -u "$(DOCKER_USERNAME)" --password-stdin
|
@echo "$(DOCKER_PASSWORD)" | $(DOCKER) login -u "$(DOCKER_USERNAME)" --password-stdin
|
||||||
|
|
|
@ -106,6 +106,15 @@ Hub](https://hub.docker.com/r/mpolden/echoip), which can be downloaded with:
|
||||||
|
|
||||||
`docker pull mpolden/echoip`
|
`docker pull mpolden/echoip`
|
||||||
|
|
||||||
|
### GeoIP support
|
||||||
|
|
||||||
|
To build the Docker Image with GeoIP support follow the following steps:
|
||||||
|
|
||||||
|
1. Clone the repo
|
||||||
|
2. Get a license key. See https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-geolite2-databases/
|
||||||
|
3. Run with replacing xxxxxxxxxxxxxxxx with the license key and USERNAME with your name: ``make docker-build GEOIP_LICENSE_KEY=xxxxxxxxxxxxxxxx DOCKER_IMAGE=USERNAME/echoip``
|
||||||
|
4. Run the image with: ``docker run -p 8080:8080 USERNAME/echoip -f country.mmdb -c city.mmdb -a asn.mmdb
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue