@@ -2,9 +2,11 @@ name: Docker Image
22
33on :
44 schedule :
5- - cron : " 0 13 * * *" # everyday at 1pm
5+ - cron : " 0 10 * * *" # everyday at 10am
6+ pull_request_target :
7+ branches : ["latest"]
68 push :
7- branches : ["** "]
9+ branches : ["latest "]
810 tags : ["v*.*.*"]
911
1012env :
@@ -20,30 +22,23 @@ jobs:
2022 - name : Set imageName based on the repository name
2123 id : step_one
2224 run : |
23- imageName="${GITHUB_REPOSITORY/docker-/}"
24- echo $imageName
25- echo "imageName=$imageName" >> $GITHUB_ENV
25+ imageName="${GITHUB_REPOSITORY/docker-/}"
26+ echo $imageName
27+ echo "imageName=$imageName" >> $GITHUB_ENV
2628 - name : Docker meta
2729 id : docker_meta
28- uses : crazy-max/ghaction-docker-meta @v5
30+ uses : docker/metadata-action @v5
2931 with :
3032 images : ${{ env.imageName }}
3133 - name : Set up QEMU
3234 uses : docker/setup-qemu-action@v3
3335 - name : Set up Docker Buildx
3436 uses : docker/setup-buildx-action@v3
35- - name : Login to Harbor
37+ - name : Login to DockerHub
3638 uses : docker/login-action@v3
3739 with :
3840 username : ${{ secrets.DOCKERHUB_USERNAME }}
3941 password : ${{ secrets.DOCKERHUB_TOKEN }}
40- - name : Buildx cache
41- uses : actions/cache@v4
42- with :
43- path : ${{ github.workspace }}/cache
44- key : ${{ runner.os }}-docker-${{ hashfiles('cache/**') }}
45- restore-keys : |
46- ${{ runner.os }}-docker
4742 - name : Build and push
4843 id : docker_build
4944 uses : docker/build-push-action@v6
5247 push : ${{ github.event_name != 'pull_request' }}
5348 tags : ${{ steps.docker_meta.outputs.tags }}
5449 labels : ${{ steps.docker_meta.outputs.labels }}
55- # cache-from: type=local,src=${{ github.workspace }}/cache
56- # cache-to: type=local,dest=${{ github.workspace }}/cache
50+
51+ - name : Docker Scout
52+ id : docker-scout-cves
53+ if : ${{ github.event_name != 'pull_request_target' }}
54+ uses : docker/scout-action@v1
55+ with :
56+ command : cves
57+ organization : beevelop
58+ image : ${{ env.imageName }}:latest
59+ to-latest : true
60+ github-token : ${{ secrets.GITHUB_TOKEN }} # to be able to write the comment
61+ sarif-file : sarif.output.json
62+
63+ - name : Upload SARIF result
64+ id : upload-sarif
65+ if : ${{ github.event_name != 'pull_request_target' }}
66+ uses : github/codeql-action/upload-sarif@v3
67+ with :
68+ sarif_file : sarif.output.json
69+
70+ - name : Compare to deployed image
71+ id : docker-scout-compare
72+ if : ${{ github.event_name == 'pull_request_target' }}
73+ uses : docker/scout-action@v1
74+ with :
75+ command : compare
76+ organization : beevelop
77+ image : ${{ steps.docker_meta.outputs.tags }}
78+ only-severities : critical,high
79+ platform : " linux/amd64"
80+ exit-on : vulnerability,policy
81+ summary : true
0 commit comments