Skip to content

Build

Build #180

Workflow file for this run

name: Build
on:
workflow_dispatch:
push:
branches: ['master']
schedule:
- cron: '0 15 */5 * *'
pull_request:
branches: ['master']
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
erikdevries/spotweb
erikdevries/rpi-spotweb
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and export to Docker
uses: docker/build-push-action@v5
with:
context: .
load: true
tags: ${{ steps.meta.outputs.tags }}
# Run Trivy vulnerability scanner to gain insight in the security of the Docker image
# Output is for informational purposes only, any vulnerabilities found under /app
# should be resolved in the spotweb repository
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: 'erikdevries/spotweb:${{ steps.meta.outputs.version }}'
severity: 'MEDIUM,CRITICAL,HIGH'
- name: Build and push
if: github.event_name != 'pull_request'
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: ${{ steps.meta.outputs.tags }}