-
Notifications
You must be signed in to change notification settings - Fork 1
/
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:2b7412e6465c3c7fc5bb21d3e6f1917c167358449fecac8176c6e496e5c1f05f 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.21.4-bookworm@sha256:52362e252f452df17c24131b021bf2ebf1c9869f65c28f88ddb326191defea9c 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:996c583af12770668a65722aeab748b4e058feac61f728c01e4763c7f31c7246
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"]