How do I build & package grafana from source?

I have a fork of Grafana where I have made some minor changes to the source. I wish to build & package my forked version of grafana, so that I end up with a .tar.gz artifact like I would find published on the grafana downloads page.

How are these artifacts build & packaged by the grafana team?
What is the correct series of scripts to run?

Some things I’ve tried so far:

  • I’ve tried building the Dockerfile in the root of the project. I can get this to succeed with some minor tweaks (increase the memory limit to node). This produces a grafana docker image which is not exactly what I want, but could maybe serve my needs - but there are many issues that suggest this Dockerfile is not the canonical build processes used by the team and may not be reliable (issue #15083, issue #39108, issue #37225).
  • I’ve tried to understand the build process by going through source, but there are a lot of moving parts. There seems to be circle ci, github actions, makefiles, docker images, bash scripts, go build scripts, go release_publisher scripts, fpm, and more. It’s hard to tell what is current.
  • One example: my best guess was ./scripts/build/ I tried executing this script from inside the grafana/build-container docker image, but it passes the -buildId= option to build.go, which seems to no longer be supported and suggests that this script is outdated.
  • Searching through issues & documentation it appears that the build process has changed over time, and this issue suggests that building & packaging from source is not supported?

Ideally I would leverage the existing build process used by the grafana team to guarantee stability & consistency.

So - how is grafana built & packaged by the grafana team? Can I use those same scripts to build & package my fork? If not, what is the recommendation?

1 Like

Making the entirety of our current release process for Grafana public is not currently on our roadmap.

You can build from source today as you noted. That’s the foundation and functionality we provide to our team and our open source community for building and running Grafana from source.

Our release and packaging processes are, at the moment, internal to Grafana Labs. We are discussion which parts, if any, we can and should make public, but have no answers at this point in time.