blumeops/docs/how-to/grafana/build-grafana-images.md
Erich Blume b75c4f970b Upgrade grafana-sidecar 1.28.0 → 2.6.0, port to container.py
The 2.x memory regression (#462) is resolved and the remaining ~35MB
overhead is static (health endpoint server), not a leak. Port the build
from Dockerfile to native Dagger container.py and add liveness/readiness
probes using the new /healthz endpoint on port 8080.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 07:28:19 -07:00

59 lines
2 KiB
Markdown

---
title: Build Grafana Images
modified: 2026-03-15
last-reviewed: 2026-03-15
tags:
- how-to
- grafana
- containers
---
# Build Grafana Images
Home-built container images for Grafana and its dashboard sidecar, published to `registry.ops.eblu.me/blumeops/`.
## Grafana
**Dockerfile:** `containers/grafana/Dockerfile`
**Image:** `registry.ops.eblu.me/blumeops/grafana`
Downloads the official Grafana OSS tarball for the target architecture (arm64/amd64), installs it into Alpine, and sets up standard paths.
```fish
# Update version in Dockerfile
# ARG CONTAINER_APP_VERSION=12.3.3
mise run container-build-and-release grafana
```
**Gotchas:**
- **Tarball directory name:** Extracts to `grafana-<version>` (e.g. `grafana-12.3.3`), *not* `grafana-v<version>`.
- **Binary PATH:** The binary lives at `bin/grafana` inside the extracted directory. The Dockerfile sets `ENV PATH="/usr/share/grafana/bin:$PATH"`.
- **UID 472:** Matches the official Grafana image for PVC ownership compatibility.
## Grafana Sidecar
**Build:** `containers/grafana-sidecar/container.py` (native Dagger)
**Image:** `registry.ops.eblu.me/blumeops/grafana-sidecar`
Clones the [kiwigrid/k8s-sidecar](https://github.com/kiwigrid/k8s-sidecar) source from the forge mirror, installs the Python package into a venv, and copies it into a Python Alpine runtime image.
```fish
# Update VERSION in container.py
mise run container-build-and-release grafana-sidecar
```
**Gotchas:**
- **UID 65534:** Matches upstream's `nobody` user convention for non-root execution.
- **Forge mirror name:** `mirrors/kiwigrid-grafana-sidecar` (not `k8s-sidecar`).
- **Health endpoint:** 2.x exposes `/healthz` on port 8080 (liveness + readiness probes configured in deployment).
## Related
- [[grafana]] — Service reference card
- [[upgrade-grafana]] — Migration context and future upgrade steps
- [[kustomize-grafana-deployment]] — Kustomize manifest structure
- [[build-container-image]] — Standard container build workflow