Sign inSign up

corentinaltepe/grafonnet

By corentinaltepe

•Updated over 4 years ago

Image
1

2.6K

corentinaltepe/grafonnet repository overview

⁠grafonnet-docker

Unofficial Grafonnet⁠ dockerfile and image for local and CI pipeline builds. Inspired by AndrewFarley/grafonnet-lib-dockerhub⁠.

This image is fit for local builds, Gitlab CI, Azure DevOps CI and probably more.

Source code here⁠.

⁠Registries and Tags

Docker images are published to DockerHub and GitHub registries.

Tags follow Grafonnet releases⁠. Find available tags here⁠ and here⁠.

⁠How To

⁠Local Builds

To build a mysourcefile.jsonnet file into a mysourcefile.json dasbhoard for Grafana.

On Windows, do a cd to your source file:

docker run --rm -v %~dp0:/here corentinaltepe/grafonnet:latest jsonnet /here/mysourcefile.jsonnet >> %~dp0mysourcefile.json

On Linux, do a cd to your source file:

docker run --rm -v $(pwd):/here corentinaltepe/grafonnet:latest jsonnet /here/mysourcefile.jsonnet >> $(pwd)/mysourcefile.json
⁠Automatically Build and Load to Grafana

The following script builds a file for Grafana's API and then pushes it to Grafana. It is written for Windows. Replace %~dp0 with $(pwd) for Linux.

::: Build the dashboard *.jsonnet to *.json
echo { "dashboard": > %~dp0mysourcefile.json
docker run --rm -v %~dp0:/here corentinaltepe/grafonnet:latest jsonnet /here/myfile.jsonnet >> %~dp0mysourcefile.json
echo , "overwrite": true} >> %~dp0mysourcefile.json

::: Load to Grafana
::: Replace admin:admin with your credentials or add authentication bearer in HTTP headers
curl -X POST -H "Content-Type: application/json" -d @%~dp0mysourcefile.json "http://admin:admin@localhost:3000/api/dashboards/db"
⁠CI Jobs
⁠Azure DevOps
- job: Build_Grafana_Dashboards
  container:
    image: corentinaltepe/grafonnet:0.1.0
  pool:
    vmImage: "ubuntu-latest"
  steps:
    # Build every .jsonnet file into a .json dashboard 
    # and place them in grafonnet-out/ directory
    - script: >
        mkdir grafonnet-out

        for file in dashboards/*.jsonnet ; do 
          name=$(basename $file)
          jsonnet $file > grafonnet-out/grafana.${name%.jsonnet}.json
        done

Tag summary

Content type

Image

Digest

Size

34 MB

Last updated

over 4 years ago

docker pull corentinaltepe/grafonnet