Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/integrate docker scout with git hub actions #564

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.DOCKERHUB_READONLY_USERNAME }}
password: ${{ secrets.DOCKERHUB_READONLY_TOKEN }}
- 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 }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ARG TARGETPLATFORM
WORKDIR /gatewayd
COPY . /gatewayd

RUN apk --no-cache add git=2.45.1-r0 make=4.4.1-r2 && \
RUN apk --no-cache add git=2.45.2-r0 make=4.4.1-r2 && \
mkdir -p dist && \
make build-platform GOOS=${TARGETOS} GOARCH=${TARGETARCH} OUTPUT_DIR=dist/${TARGETOS}-${TARGETARCH}

Expand Down
Loading