Skip to content

ci: cache the Trivy database (#12) #6

ci: cache the Trivy database (#12)

ci: cache the Trivy database (#12) #6

name: Deploy to GitHub Container Registry
on:
workflow_dispatch:
push:
branches: ["main"]
schedule:
# Runs every Monday and Thursday at 15:39 UTC, which is either
# 8:49 AM or 9:49 AM ET, depending on Daylight Savings Time. This
# is two hours before the prod deploy, so we can see how dev is
# doing before approving a prod deploy.
- cron: "49 13 * * 1,4"
env:
REGISTRY: ghcr.io
PLATFORMS: linux/amd64,linux/arm64
TAG: ghcr.io/${{ github.repository_owner }}/ors:latest
jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
platforms: ${{ env.PLATFORMS }}
tags: ${{ env.TAG }}
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: ${{ env.TAG }}
trivy-config: trivy.yml
env:
TRIVY_SKIP_DB_UPDATE: true
TRIVY_SKIP_JAVA_DB_UPDATE: true