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"]