|
| 1 | +name: Docker Build |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [ "master", "main" ] |
| 5 | + pull_request: |
| 6 | + branches: [ "master", "main" ] |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: read |
| 10 | + |
| 11 | +jobs: |
| 12 | + docker-build: |
| 13 | + name: Dockerfiles Build |
| 14 | + runs-on: ubuntu-latest |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + dockerfiles: [ 'ubuntu22.04', 'ubuntu18.04', 'centos7.9' ] |
| 19 | + permissions: |
| 20 | + actions: read |
| 21 | + contents: read |
| 22 | + security-events: write |
| 23 | + defaults: |
| 24 | + run: |
| 25 | + shell: bash |
| 26 | + timeout-minutes: 90 |
| 27 | + steps: |
| 28 | + - name: Harden Runner |
| 29 | + uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1 |
| 30 | + with: |
| 31 | + egress-policy: audit |
| 32 | + |
| 33 | + - name: Checkout |
| 34 | + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 |
| 35 | + |
| 36 | + - name: Set up QEMU |
| 37 | + uses: docker/setup-qemu-action@5927c834f5b4fdf503fca6f4c7eccda82949e1ee # v3.1.0 |
| 38 | + |
| 39 | + - name: Set up Docker Buildx |
| 40 | + uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3.4.0 |
| 41 | + with: |
| 42 | + buildkitd-flags: --debug |
| 43 | + |
| 44 | + - name: 'Build Dockerfile for ${{ matrix.dockerfiles }}' |
| 45 | + uses: docker/build-push-action@1a162644f9a7e87d8f4b053101d1d9a712edc18c # v6.3.0 |
| 46 | + with: |
| 47 | + file: '${{ github.workspace }}/docker/Dockerfile.${{ matrix.dockerfiles }}' |
| 48 | + context: . |
| 49 | + push: false |
| 50 | + tags: 'docker.io/openvisualcloud/raisr/${{ matrix.dockerfiles }}:${{ github.sha }}' |
| 51 | + |
| 52 | + - name: 'Run Trivy vulnerability scanner on result' |
| 53 | + uses: aquasecurity/trivy-action@0.20.0 |
| 54 | + with: |
| 55 | + image-ref: 'docker.io/openvisualcloud/raisr/${{ matrix.dockerfiles }}:${{ github.sha }}' |
| 56 | + exit-code: '1' |
| 57 | + ignore-unfixed: true |
| 58 | + vuln-type: 'os,library' |
| 59 | + severity: 'CRITICAL,HIGH' |
| 60 | + format: 'sarif' |
| 61 | + output: '${{ github.workspace }}/trivy-${{ matrix.dockerfiles }}-${{ github.sha }}.sarif' |
| 62 | + |
| 63 | + - name: 'Upload Trivy scan results to GitHub Security tab' |
| 64 | + uses: github/codeql-action/upload-sarif@v2 |
| 65 | + with: |
| 66 | + sarif_file: '${{ github.workspace }}/trivy-${{ matrix.dockerfiles }}-${{ github.sha }}.sarif' |
0 commit comments