Building Grafana from source


I am trying to build Grafana from source on windows, in order to add some new features at the Grafana version that i am using (

I am following step by step the instructions given by Grafana documentation (
Firstly i am setting my path accordingly at the directory i have created for my project and i am executing ‘setx GOPATH %cd%’ and ‘go get’. Both commands show me no errors.

Then i am building the back-end by setting my path to ‘cd src/’ and executing ‘go run build.go setup’ and ‘go run build.go build’. Again i have no errors from these commands. I am executing ‘npm --add-python-to-path=‘true’ --debug install --global windows-build-tools’ as an administrator and continue building the front-end.

At the beginning, i am trying to execute ‘npm install -g yarn’ and ‘yarn install --pure-lockfile’, but an error comes up for the second command stating the yarn command is not recognizable. After i copy the yarn file from the directory it is installed,.to / (directory) the command is executed properly.

However, whenever i try to run the ‘yarn watch’ command, the execution of the command never ends (even though no errors are shown).

Is there any configuration that i have to do first in order to run properly this command? Or it might be that i am doing something wrong with the previous ones? Also, would it be possible to skip this command and continue with the other ones? Or is it necessary for building Grafana?

Thank you in advance!

Please if there are other similar questions, let me know!

I can’t help you but since there is this topic I’ll ask a question too.

I want to edit the front end. If I do the modifications before building it works, but everything done after building (even if i follow the instructions again) won’t change anything.

Does somebody have an idea about what I’m doing wrong?


@kasmir Thank you for your reply. Just to make it more clear for me:

You make changes at the front-end and if you run ‘grafana-server.exe’ you can see everything you have done. But when you build Grafana from source, all of your changes are gone. Is this the case? Where exactly are you applying the changes (what i mean is: are you making changes just for a plugin you would like to use, or is it something else you are using?)

hey there I don’t know why yesterday it wasn’t working but today it does.

I make all the changes I want in “variable.dark.scss” then I run:
“npm run dev”
“npm run watch”

then it works. But it seems that modifiying scss files in “components” directory doesn’t affect anything

@kasmir Thank you for your reply! Now i understand better what you are doing. I have a similar problem. I am trying to change sth in a folder, but it doesn’t affect anything. I believe this is because i need to build Grafana from source (with the change i made) in order to work.

I had the same problem.
I will try doing what you propose.
Thank you!

I am not sure, if this helps you guys. I used Dockerfile located on the root directory of the project - and it builds the complete stack just fine. It also includes any changes that I make.

@hassanfarid, Can you please share the steps you followed to build a docker image.

“make build-docker-dev” is throwing the below error on centos 6

cp dist/grafana-latest.linux-x64.tar.gz packaging/docker
cd packaging/docker && docker build --tag grafana/grafana:dev .
Sending build context to Docker daemon 55.68 MB
Sending build context to Docker daemon
Step 0 : ARG
Unknown instruction: ARG
make: *** [build-docker-dev] Error 1


Hi @ajs1985,

As I mentioned earlier - I used the Dockerfile available on github

I build from the source code on the mac, it always stop on the step below:

do you ever meet this issue before?

How do I package Grafana 7.5 from source code?

1 Like

I also am surprised that I couldn’t find any official docs for this, and that there doesn’t seem to be any help here.
This got me going, but whether it is the ‘official’ way I don’t know.