Skip to content

ui-fixes, can now turn on or off metrics in graph by clicking on gaug… #28

ui-fixes, can now turn on or off metrics in graph by clicking on gaug…

ui-fixes, can now turn on or off metrics in graph by clicking on gaug… #28

name: Docker Build and Publish
on:
push:
branches: [ main ]
release:
types: [ published ]
env:
GHCR_IMAGE: ghcr.io/${{ github.repository }}
DOCKER_IMAGE: ${{ secrets.DOCKERHUB_USERNAME }}/gpu-monitor
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write # Needed for provenance signing
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: |
image=moby/buildkit:latest
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.GHCR_IMAGE }}
${{ env.DOCKER_IMAGE }}
tags: |
type=ref,event=branch
type=raw,value=latest,enable={{is_default_branch}}
type=sha,prefix={{date 'YYYYMMDD'}}-
labels: |
org.opencontainers.image.title=GPU Monitor
org.opencontainers.image.description=Real-time NVIDIA GPU monitoring dashboard
org.opencontainers.image.vendor=${{ github.repository_owner }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
sbom: true
provenance: mode=max
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Export SBOM
run: |
mkdir -p sbom
# Wait a moment for the image to be available
sleep 10
DIGEST=$(docker buildx imagetools inspect ${{ env.GHCR_IMAGE }}:main --raw)
echo "Image digest: $DIGEST"
docker buildx imagetools inspect ${{ env.GHCR_IMAGE }}@$DIGEST \
--format '{{ json .SBOM }}' > sbom/bom.json || echo "SBOM export failed but continuing"
# Optional: Upload SBOM
- name: Upload SBOM
uses: actions/upload-artifact@v3
with:
name: sbom
path: sbom/bom.json
retention-days: 5