2024-08-24 08:01:56 +02:00
|
|
|
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
|
|
|
|
|
2024-08-24 09:04:46 +02:00
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
|
2024-08-24 08:22:37 +02:00
|
|
|
- name: Log in to Docker Hub
|
2024-08-24 08:18:49 +02:00
|
|
|
uses: docker/login-action@v3
|
2024-08-24 08:01:56 +02:00
|
|
|
with:
|
2024-08-24 08:22:37 +02:00
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
2024-08-24 08:01:56 +02:00
|
|
|
|
2024-08-24 09:04:46 +02:00
|
|
|
- name: Build multiarch Docker image
|
2024-08-24 08:01:56 +02:00
|
|
|
id: build-image
|
|
|
|
run: |
|
2024-08-24 09:04:46 +02:00
|
|
|
docker buildx create --use
|
2024-08-24 09:06:57 +02:00
|
|
|
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t wg-dashboard:latest .
|
2024-08-24 08:01:56 +02:00
|
|
|
|
2024-08-24 09:18:21 +02:00
|
|
|
- name: Docker Scout Analysis
|
2024-08-24 09:04:46 +02:00
|
|
|
id: docker-scout
|
2024-08-24 09:18:21 +02:00
|
|
|
run: |
|
|
|
|
docker run --rm \
|
|
|
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
|
|
|
docker/scout-action:v1 \
|
|
|
|
cves \
|
|
|
|
--image wg-dashboard:latest \
|
|
|
|
--github-token ${{ secrets.GITHUB_TOKEN }}
|