-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
24 lines (17 loc) · 927 Bytes
/
Dockerfile
File metadata and controls
24 lines (17 loc) · 927 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Compile Golang
FROM golang:1.25 AS builder
COPY . /data
WORKDIR /data
RUN CGO_ENABLED=0 go build
# Download maxmind db
ARG MAXMIND_LICENSE
RUN wget "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&suffix=tar.gz&license_key=${MAXMIND_LICENSE}" -O GeoLite2-City.tar.gz && tar -xvf GeoLite2-City.tar.gz --strip-components 1 --wildcards */GeoLite2-City.mmdb
RUN wget "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-ASN&suffix=tar.gz&license_key=${MAXMIND_LICENSE}" -O GeoLite2-ASN.tar.gz && tar -xvf GeoLite2-ASN.tar.gz --strip-components 1 --wildcards */GeoLite2-ASN.mmdb
# Get alpine
FROM alpine:3.13.0
RUN apk add --no-cache tzdata
COPY --from=builder /data/geoip-api /bin/geoip-api
RUN mkdir -p /data
COPY --from=builder /data/GeoLite2-City.mmdb /data/GeoLite2-City.mmdb
COPY --from=builder /data/GeoLite2-ASN.mmdb /data/GeoLite2-ASN.mmdb
ENTRYPOINT [ "/bin/geoip-api" ]