-
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:27cb6e6ccef575a4698b66f5de06c7ecd61589132d5a91d098f7f3f9285415a9 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.19.5-buster@sha256:150a98859da4c88935958d21d4fca1c74a139eac88e1eb2364c8f60d69236ede 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:a08c76433d484340bd97013b5d868edfba797fbf83dc82174ebd0768d12f491d
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"]