2023-05

2023-05-09 Grafana for Multiple Architectures in 8 Minutes or Less by Kevin Minehart #dagger #grafana

In this blog post, we’ll share the story of Dagger community member Kevin Minehart (aka @Kevin on Discord).

Kevin, a software engineer at Grafana Labs, uses Dagger to create bespoke Grafana packages for end-users.

Previously, Kevin built every package using a remote CI engine, which was a time-consuming process. With Dagger, Kevin is able to build packages locally in 8 minutes or less…a build-time improvement of ~75%!

The solution: Fast, consistent local and remote builds with Dagger

Kevin had heard about Dagger previously and had experimented with it in some personal projects. As he was already familiar with it, he decided to try and automate the Grafana packaging process using Dagger’s Go SDK. With Dagger, he was able to consolidate all the packaging tasks into a standalone Dagger pipeline that could be invoked with a single command.

The future: Using Dagger for all Grafana packaging processes

Going forward, Kevin plans to add service containers to his team’s Dagger pipeline for integration testing.

He is also hoping to use Dagger’s support for remote caching when it becomes available.

In the near future, he plans to start using Dagger to build Grafana automatically, and then replace the existing packaging processes with the new Dagger pipeline.

Note

“I don’t think I can emphasize enough the value that Dagger has given us. We were not able to even build a Grafana package locally before this. So Dagger was a huge win for us.”

Update 2023-07-06

FROM golang:1.20-alpine

ARG DAGGER_VERSION=v0.6.3

WORKDIR /src

ADD . .
RUN apk add --update git docker wget
RUN go build -o /src/grafana-build ./cmd

# Install dagger
RUN wget "https://github.com/dagger/dagger/releases/download/${DAGGER_VERSION}/dagger_${DAGGER_VERSION}_linux_amd64.tar.gz"
RUN tar -xvf ./dagger_${DAGGER_VERSION}_linux_amd64.tar.gz && mv dagger /bin

ENTRYPOINT ["dagger", "run", "/src/grafana-build"]