Skip to content

Build and Push Grafana Docker Image #1

Build and Push Grafana Docker Image

Build and Push Grafana Docker Image #1

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.11
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
cp /home/runner/work/Grafana.Plugin.CostManagement/Grafana.Plugin.CostManagement/grafana-files/grafana.ini .
cd ..
# Login against a Docker registry except on PR
# https://github.com/docker/#-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/#-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 }}
docker push ghcr.io/dfe-digital/grafana-azurecostplugin-grafana:${{ env.PLUGIN_VERSION }}
env:
DOCKER_BUILDKIT: 1
DOCKER_CLI_ACI: 1