Skip to content

Build and Push Grafana Docker Image #24

Build and Push Grafana Docker Image

Build and Push Grafana Docker Image #24

Workflow file for this run

name: Build and Push Grafana Docker Image
on:
workflow_dispatch:
release:
types: [published]
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
RELEASE_TAG: ${{ github.event.release.tag_name }}
PLUGIN_VERSION: 1.0.10
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Download Grafana Plugin
run: |
mkdir -p latest-cost-plugin
cd latest-cost-plugin
wget "https://github.com/DFE-Digital/Grafana.Plugin.CostManagement/releases/download/main/dfe-azurecostbackend-datasource-${{ env.PLUGIN_VERSION }}.zip"
wget "https://grafana.com/api/plugins/blackcowmoo-googleanalytics-datasource/versions/0.2.3/download" -O blackcowmoo-googleanalytics-datasource-0.2.3.zip
ls
unzip -o dfe-azurecostbackend-datasource-${{ env.PLUGIN_VERSION }}.zip
unzip -o blackcowmoo-googleanalytics-datasource-0.2.3.zip
cd ..
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker Image
run: |
docker build . -t ghcr.io/dfe-digital/grafana-azurecostplugin-grafana:${{ env.PLUGIN_VERSION }}
- name: Copy and Validate grafana.ini copy
run: |
# Display the contents of grafana dir to verify the presence of grafana.ini
ls -l /var/lib/grafana
sudo cp -f /home/runner/work/Grafana.Plugin.CostManagement/Grafana.Plugin.CostManagement/grafana-files/grafana.ini /var/lib/grafana
ls -l /var/lib/grafana
cat /var/lib/grafana/grafana.ini
shell: bash
- name: Push Docker Image
run: |
docker push ghcr.io/dfe-digital/grafana-azurecostplugin-grafana:${{ env.PLUGIN_VERSION }}
env:
DOCKER_BUILDKIT: 1
DOCKER_CLI_ACI: 1