mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2024-12-30 02:43:24 +08:00
39 lines
1.1 KiB
YAML
39 lines
1.1 KiB
YAML
name: Docker Image Build and Analysis
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "0 0 * * *" # Schedule the workflow to run daily at midnight (UTC time). Adjust the time if needed.
|
|
workflow_dispatch: # Manual run trigger
|
|
inputs:
|
|
trigger-build:
|
|
description: 'Trigger a manual build and push'
|
|
default: 'true'
|
|
|
|
jobs:
|
|
build-and-analyze:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Log in to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Build Docker image
|
|
id: build-image
|
|
run: |
|
|
docker build -t my-app-image:latest .
|
|
|
|
- name: Install Docker Scout
|
|
run: |
|
|
curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --
|
|
|
|
- name: Analyze Docker image with Docker Scout
|
|
id: analyze-image
|
|
run: |
|
|
docker scout cves my-app-image:latest > scout-results.json
|
|
cat scout-results.json # Print the report to the workflow logs for easy viewing
|