Skip to content

Commit

Permalink
added Docker Scout step
Browse files Browse the repository at this point in the history
  • Loading branch information
sinadarbouy committed Jun 7, 2024
1 parent 7b42cf5 commit f5ccae4
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 58 deletions.
58 changes: 0 additions & 58 deletions .github/workflows/docker_scout.yaml

This file was deleted.

49 changes: 49 additions & 0 deletions .github/workflows/vulnerability-comparison.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Vulnerability Comparison

on:
pull_request:
branches: ["**"]

env:
# Image repository, without hostname and tag
IMAGE_NAME: ${{ github.repository }}
SHA: ${{ github.event.pull_request.head.sha || github.event.after }}

jobs:
vulnerability-comparison:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ env.SHA }}
- name: Set short SHA
id: vars
run: echo "SHA_SHORT=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
load: ${{ github.event_name == 'pull_request' }}
tags: "ghcr.io/${{ env.IMAGE_NAME }}:${{ env.SHA_SHORT }}"
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Authenticate to Docker
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PAT }}
- name: Docker Scout
id: docker-scout
uses: docker/scout-action@v1
with:
command: compare
image: "gatewaydio/gatewayd:latest"
to: "ghcr.io/${{ env.IMAGE_NAME }}:${{ env.SHA_SHORT }}"
ignore-unchanged: true
only-severities: critical,high
github-token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit f5ccae4

Please sign in to comment.