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.
Docker images are published to DockerHub and GitHub registries.
Tags follow Grafonnet releases. Find available tags here and here.
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
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"
- 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
Content type
Image
Digest
Size
34 MB
Last updated
over 4 years ago
docker pull corentinaltepe/grafonnet