container-images/adguard-exporter/Dockerfile
Andreas Meier e1d798c432
All checks were successful
Build and push adguard-exporter image / build-and-push-image (push) Successful in 3m54s
fix(adguard-exporter): create empty GeoLite2 placeholder to skip geo metrics
2026-06-26 13:07:00 +02:00

35 lines
760 B
Docker

FROM --platform=$BUILDPLATFORM golang:1.26-alpine AS build
WORKDIR /app
RUN apk add --no-cache ca-certificates git
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ARG TARGETOS
ARG TARGETARCH
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH \
go build -ldflags="-s -w" -o adguard-exporter .
# Create empty GeoLite2 placeholder (geo metrics disabled without real DB)
RUN touch /app/GeoLite2-City.mmdb
FROM alpine:3.24 AS certs
RUN apk add --no-cache ca-certificates
FROM scratch
WORKDIR /
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=build /app/adguard-exporter /adguard-exporter
COPY --from=build /app/GeoLite2-City.mmdb /GeoLite2-City.mmdb
USER 65532:65532
EXPOSE 9200
ENTRYPOINT ["/adguard-exporter"]