50 lines
1.2 KiB
YAML
50 lines
1.2 KiB
YAML
name: build
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
REGISTRY: harbor.furynrage.com
|
|
IMAGE: harbor.furynrage.com/demo-app/app
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to Zot
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ secrets.REGISTRY_USER }}
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
- name: Compute tag
|
|
id: tag
|
|
run: echo "sha=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_OUTPUT
|
|
|
|
- name: Build & push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
platforms: linux/arm64
|
|
push: true
|
|
tags: |
|
|
${{ env.IMAGE }}:${{ steps.tag.outputs.sha }}
|
|
${{ env.IMAGE }}:latest
|
|
|
|
- name: Trivy scan
|
|
uses: aquasecurity/trivy-action@0.24.0
|
|
with:
|
|
image-ref: ${{ env.IMAGE }}:${{ steps.tag.outputs.sha }}
|
|
format: table
|
|
severity: CRITICAL,HIGH
|
|
exit-code: '0' # для демо не падаем, только репорт
|