Merge pull request #660 from DaanSelen/workflow-fix

Workflow fix.
This commit is contained in:
Donald Zou 2025-03-24 04:16:34 +08:00 committed by GitHub
commit 8137a46c68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 53 deletions

View File

@ -1,50 +0,0 @@
name: Docker-Analyze
on:
schedule:
- cron: "0 0 * * *" # Daily at midnight UTC
workflow_dispatch:
inputs:
trigger-build:
description: 'Trigger a manual build and push'
default: 'true'
env:
DOCKER_IMAGE: donaldzou/wgdashboard
jobs:
docker_analyze:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Install Docker Scout
run: |
echo "Installing Docker Scout..."
curl -fsSL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --
echo "Docker Scout installed successfully."
- name: Analyze Docker image with Docker Scout
id: analyze-image
run: |
echo "Analyzing Docker image with Docker Scout..."
docker scout cves ${{ env.DOCKER_IMAGE }}:latest > scout-results.txt
cat scout-results.txt
echo "Docker Scout analysis completed."
- name: Fail if critical CVEs are found
run: |
if grep -q "0C" scout-results.txt; then
echo "No critical vulnerabilities found! Continueing."
exit 0
else
echo "At least one critical vulnerabilities found! Exiting."
exit 1
fi

View File

@ -1,4 +1,4 @@
name: Docker-Build name: Docker Scan and Build
on: on:
push: push:
@ -10,10 +10,10 @@ on:
default: 'true' default: 'true'
env: env:
DOCKER_IMAGE: donaldzou/wgdashboard DOCKER_IMAGE: ${{ secrets.DOCKER_HUB_USERNAME }}/wgdashboard
jobs: jobs:
docker_build: docker_build_analyze:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
fail-fast: false fail-fast: false
@ -42,3 +42,12 @@ jobs:
push: true push: true
tags: ${{ env.DOCKER_IMAGE }}:latest tags: ${{ env.DOCKER_IMAGE }}:latest
platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7 platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7
- name: Docker Scout
id: docker-scout
uses: docker/scout-action@v1
with:
command: quickview,cves
image: image://${{ env.DOCKER_IMAGE }}:latest
summary: true
only-severities: critical,high,medium,low,unspecified