trivy action corrected #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Build | |
on: | |
workflow_call: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
env: | |
BUILD_TYPE: "Release" | |
DOCKER_IMAGE_NAME: "docker.io/ovc/tiber-broadcast-suite" | |
DOCKER_IMAGE_TAG: "${{ github.sha }}" | |
DEBIAN_FRONTEND: "noninteractive" | |
jobs: | |
docker: | |
name: "Dockerfile build for Intel® Tiber™ Broadcast Suite" | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 120 | |
steps: | |
- name: "Preparation: Harden Runner" | |
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1 | |
with: | |
egress-policy: audit | |
- name: "Memory and swap report before" | |
run: | | |
sudo free -h | |
sudo lsblk | |
- name: "Set swap to 20Gi" | |
shell: bash | |
run: | | |
export SWAP_FILE=$(sudo swapon --show=NAME | tail -n 1) | |
sudo swapoff $SWAP_FILE | |
sudo rm $SWAP_FILE | |
sudo fallocate -l 20480M $SWAP_FILE | |
sudo chmod 600 $SWAP_FILE | |
sudo mkswap $SWAP_FILE | |
sudo swapon $SWAP_FILE | |
- name: "Memory and swap report after" | |
run: | | |
sudo free -h | |
sudo lsblk | |
- name: "Preparation: Repository Checkout" | |
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
- name: "Configuration: Docker with Buildx Toolkit set up" | |
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 | |
with: | |
buildkitd-flags: --debug | |
- name: "Validation: Build/Push Dokcerfile" | |
uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5.4.0 | |
with: | |
file: Dockerfile | |
context: . | |
push: false | |
load: true | |
tags: "${{ env.DOCKER_IMAGE_NAME }}:${{ env.DOCKER_IMAGE_TAG }}" | |
- name: "Validation: Run Trivy vulnerability scanner on image" | |
uses: aquasecurity/trivy-action@595be6a0f6560a0a8fc419ddf630567fc623531d # v0.22.0 | |
with: | |
image-ref: "${{ env.DOCKER_IMAGE_NAME }}:${{ env.DOCKER_IMAGE_TAG }}" | |
format: "sarif" | |
output: "trivy-image-scan-tiber-${{ env.DOCKER_IMAGE_TAG }}.sarif" | |
- name: "Finish: Upload Trivy scan results to GitHub Security tab" | |
uses: github/codeql-action/upload-sarif@2e230e8fe0ad3a14a340ad0815ddb96d599d2aff # v3.25.8 | |
with: | |
sarif_file: "trivy-image-scan-tiber-${{ env.DOCKER_IMAGE_TAG }}.sarif" |