-
Notifications
You must be signed in to change notification settings - Fork 1
/
pomerium-datasource-ip2location.dockerfile
31 lines (21 loc) · 1.04 KB
/
pomerium-datasource-ip2location.dockerfile
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
FROM ubuntu:latest@sha256:dfd64a3b4296d8c9b62aa3309984f8620b98d87e47492599ee20739e8eb54fbf as curl
RUN apt-get update && apt-get install -y curl
WORKDIR /download
RUN --mount=type=secret,id=download_token \
export DOWNLOAD_TOKEN=$(cat /run/secrets/download_token) && \
curl --silent --show-error --fail \
-o /download/IP2LOCATION-LITE-DB1.CSV.ZIP \
"https://www.ip2location.com/download/?token=${DOWNLOAD_TOKEN}&file=DB1LITECSV"
FROM golang:1.20.4-buster@sha256:4cf6dc46fc03a7aecde79ccc135d875129145b065cb1d29747ac7c8d86979266 as build
WORKDIR /build
COPY Makefile ./Makefile
COPY go.mod go.sum ./
RUN go mod download
COPY ./cmd/ ./cmd/
COPY ./internal/ ./internal/
COPY ./pkg/ ./pkg/
RUN make build
FROM gcr.io/distroless/base-debian11@sha256:df13a91fd415eb192a75e2ef7eacf3bb5877bb05ce93064b91b83feef5431f37
COPY --from=build /build/bin/* /bin/
COPY --from=curl /download/IP2LOCATION-LITE-DB1.CSV.ZIP /usr/share/IP2LOCATION-LITE-DB1.CSV.ZIP
ENTRYPOINT ["/bin/pomerium-datasource", "ip2location", "/usr/share/IP2LOCATION-LITE-DB1.CSV.ZIP"]