Skip to content

Commit

Permalink
Building docker image by default
Browse files Browse the repository at this point in the history
  • Loading branch information
arlake228 committed Feb 25, 2024
1 parent ae4f269 commit ec554dd
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 4 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/publish_docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: perfSONAR Grafana Image

# This action builds Docker images of Grafana then
# pushes result to GitHub Container Registry.

on:
push:
branches: [ '*' ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
pull_request:
branches: [ 'main' ]

env:
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_BASE: ${{ github.repository }}
BUILD_DIR: perfsonar-grafana/perfsonar-grafana

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2

# 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@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_BASE }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker images
id: build-and-push
uses: docker/build-push-action@v3
with:
context: ${{ env.BUILD_DIR }}
file: ${{ env.BUILD_DIR }}/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
5 changes: 3 additions & 2 deletions perfsonar-grafana/perfsonar-grafana/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ COPY . /usr/lib/perfsonar/grafana

USER root
#Setup provisioning
RUN sed -i /usr/lib/perfsonar/grafana/provisioning/dashboards/*.yaml -e 's/allowUiUpdates: false/allowUiUpdates: true/g'
RUN sed -i /usr/lib/perfsonar/grafana/provisioning/datasources/*.yaml -e 's/localhost/34.171.24.112/g'
RUN mkdir -p /usr/lib/perfsonar/grafana/dashboards/empty
RUN cp -r /usr/lib/perfsonar/grafana/images/* /usr/share/grafana/public/img/
RUN sed -i /usr/lib/perfsonar/grafana/provisioning/dashboards/*.yaml -e 's/allowUiUpdates: false/allowUiUpdates: true/g'
#Uncomment below to point datasource at different MA by default
#RUN sed -i /usr/lib/perfsonar/grafana/provisioning/datasources/*.yaml -e 's/localhost/34.171.24.112/g'

USER grafana
EXPOSE 3000
Expand Down
4 changes: 2 additions & 2 deletions perfsonar-grafana/perfsonar-grafana/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: '3.7'
services:
grafana_dev:
grafana:
restart: &grafana-restart always
image: perfsonar/grafana-dev:latest
image: ghcr.io/perfsonar/grafana:latest
build:
context: .
dockerfile: Dockerfile
Expand Down

0 comments on commit ec554dd

Please sign in to comment.