fix(ci): pin trivy-action to v0.36.0 (0.28.0 doesn't exist) #73
This file contains hidden or 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 | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "Dockerfile" | |
| - "**.py" | |
| - "requirements.txt" | |
| - "static/**" | |
| - "templates/**" | |
| - "app/**" | |
| - ".github/workflows/docker.yml" | |
| tags: | |
| - "v*.*.*" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| packages: write # push to GHCR | |
| jobs: | |
| build: | |
| name: Build & push | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| # ββ Vulnerability + secret + misconfig scan βββββββββββββββββββββββββββ | |
| # Runs before the build so a CVE in requirements.txt or a leaked secret | |
| # blocks the push entirely. `ignore-unfixed` keeps the gate actionable: | |
| # only CVEs that *have* a fix available will fail the job. | |
| - name: Trivy scan (filesystem) | |
| uses: aquasecurity/[email protected] | |
| with: | |
| scan-type: fs | |
| scan-ref: . | |
| severity: CRITICAL,HIGH | |
| exit-code: "1" | |
| ignore-unfixed: true | |
| scanners: vuln,secret,misconfig | |
| # ββ Multi-platform builder (amd64 + arm64) ββββββββββββββββββββββββββββ | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| # ββ Login to registries βββββββββββββββββββββββββββββββββββββββββββββββ | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Login to Docker Hub | |
| if: ${{ env.DOCKERHUB_TOKEN != '' }} | |
| uses: docker/login-action@v4 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| env: | |
| DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | |
| # ββ Tags & OCI labels βββββββββββββββββββββββββββββββββββββββββββββββββ | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v6 | |
| with: | |
| images: | | |
| ghcr.io/stackopshq/ghostbit | |
| stackopshq/ghostbit | |
| tags: | | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}} | |
| type=edge,branch=main | |
| type=sha,prefix=sha-,format=short | |
| labels: | | |
| org.opencontainers.image.title=Ghostbit | |
| org.opencontainers.image.description=Self-hosted, end-to-end encrypted paste service | |
| org.opencontainers.image.vendor=StackOps HQ | |
| org.opencontainers.image.licenses=MIT | |
| org.opencontainers.image.documentation=https://docs.ghostbit.dev | |
| # ββ Build & push ββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| - name: Build and push | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |