-
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:962425e8c7e922d472140c4ac35e009141eb21bb38c72f7125a870f521d9c0d3 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.0-bookworm@sha256:925fe3fa28ba428cf67a7947ae838f8a1523117b40e3e6b5106c378e3f97fa29 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:1d91d5f201f4be1ab11bdbcd3ef9d1a42bdfd29863bb007eba11eaa55172f85d
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"]