diff --git a/.github/workflows/scan-docker-vulnerabilities.yml b/.github/workflows/scan-docker-vulnerabilities.yml new file mode 100644 index 000000000..cd184bf3b --- /dev/null +++ b/.github/workflows/scan-docker-vulnerabilities.yml @@ -0,0 +1,43 @@ +name: Scan Docker image vulnerabilities + +on: + workflow_dispatch: # allow manual execution + schedule: + # Run weekly + - cron: '0 0 * * 0' + pull_request: + paths: + - 'Dockerfile' + - 'requirements*.txt' + - 'setup.cfg' + - '.github/workflows/scan-docker-vulnerabilities.yml' + +jobs: + scan-docker: + name: Inspect Docker image with ScanCode.io + runs-on: ubuntu-24.04 + permissions: + contents: read + + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - name: Build Docker image locally + run: docker build -t vulnerablecode:scan . + + - name: Save Docker image archive for ScanCode.io + run: | + mkdir -p scancode-inputs + docker save vulnerablecode:scan -o scancode-inputs/vulnerablecode-image.tar + + - name: Fail on known vulnerabilities + uses: aboutcode-org/scancode-action@76777db8400d719de67ba3e465c5881037b45cb9 # v0.1 + with: + pipelines: "analyze_docker_image,find_vulnerabilities" + check-compliance: true + compliance-fail-on-vulnerabilities: true + env: + VULNERABLECODE_URL: https://public.vulnerablecode.io/ +