blumeops/containers/unpoller/Dockerfile
Erich Blume 4dc3e5cae2
All checks were successful
Build Container (Nix) / detect (push) Successful in 2s
Build Container / detect (push) Successful in 2s
Build Container (Nix) / build (unpoller) (push) Successful in 2s
Build Container / build (unpoller) (push) Successful in 7s
Add UnPoller for UniFi network metrics (#298)
## Summary
- Deploy UnPoller as a k8s service on indri to export UniFi controller metrics to Prometheus
- Custom-built container from forge mirror (`containers/unpoller/Dockerfile`)
- Credentials pulled from 1Password via external-secrets
- Prometheus scrape job added, docs and service-versions updated

## Test plan
- [ ] Build container: `mise run container-release unpoller v2.34.0`
- [ ] Update kustomization tag with built image tag
- [ ] Deploy from branch: `argocd app set unpoller --revision feature/unpoller && argocd app sync unpoller`
- [ ] Verify pod connects to UX7 controller (check logs)
- [ ] Confirm `unpoller` target appears in Prometheus
- [ ] Query `unifi_` metrics in Grafana

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Reviewed-on: #298
2026-03-16 15:52:45 -07:00

40 lines
1.1 KiB
Docker

# UnPoller — UniFi metrics exporter for Prometheus
# Two-stage build: Go compilation, then minimal Alpine runtime
ARG CONTAINER_APP_VERSION=v2.34.0
FROM golang:alpine3.22 AS build
ARG CONTAINER_APP_VERSION
RUN apk add --no-cache git
RUN git clone --depth 1 --branch ${CONTAINER_APP_VERSION} \
https://forge.ops.eblu.me/mirrors/unpoller.git /app
WORKDIR /app
ENV CGO_ENABLED=0
RUN go build -ldflags="-s -w \
-X main.version=${CONTAINER_APP_VERSION} \
-X main.builtBy=blumeops \
-X golift.io/version.Version=${CONTAINER_APP_VERSION} \
-X golift.io/version.Branch=HEAD \
-X golift.io/version.BuildUser=blumeops \
-X golift.io/version.Revision=blumeops-build" \
-o /bin/unpoller .
FROM alpine:3.22
LABEL org.opencontainers.image.title="UnPoller"
LABEL org.opencontainers.image.description="UniFi metrics exporter for Prometheus"
LABEL org.opencontainers.image.source="https://github.com/unpoller/unpoller"
RUN apk add --no-cache ca-certificates tzdata
COPY --from=build /bin/unpoller /usr/bin/unpoller
EXPOSE 9130
USER 65534:65534
ENTRYPOINT ["/usr/bin/unpoller"]
CMD ["--config", "/etc/unpoller/up.conf"]