Build custom Docker Grafana from source

  • What Grafana version and what operating system are you using?
    I forked the latest github sources from grafana.

  • What are you trying to achieve?
    I managed to change the frontend according to our needs and also successfully build the backend and frontend on a local machine. I’m a bit stuck how to create a docker image from our own build.

  • How are you trying to achieve it?
    Tried to copy the public/build folder to the already existing docker image of grafana but it’s not showing out changes.

What is the best way of creating a own docker grafana image from a forked grafana repository and own build.

Any help woul be great.
Thanks

There is a Dockerfile in the root directory of Grafana. Using the following command, we can build Grafana image:

docker build -t grafana-custom -f Dockerfile .  

The image created might be bigger than what Grafana image is.

docker images | grep grafana-custom                                                                                                                                        [22:42:24]
grafana-custom                                                                            latest                   8cef3c310a78   3 minutes ago    532MB

Here we built the image via GitHub pipeline for a project.

Here’s the link to documentation.