-
Notifications
You must be signed in to change notification settings - Fork 0
/
pomerium-datasource-ip2location.dockerfile
31 lines (21 loc) · 1.05 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:3f85b7caad41a95462cf5b787d8a04604c8262cdcdf9a472b8c52ef83375fe15 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.22.3-bookworm@sha256:5c56bd47228dd572d8a82971cf1f946cd8bb1862a8ec6dc9f3d387cc94136976 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-debian12:debug@sha256:fe3521b45c4985199f810f7db472de6cd6164799ed13605db1d699011e860c23
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"]