-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (70 loc) · 2.11 KB
/
docker-publish.yml
File metadata and controls
76 lines (70 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Update image
on:
workflow_dispatch: {}
schedule:
- cron: '0 0 * * 0'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
security-events: write
actions: read
steps:
- name: Checkout repository
id: checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Setup Docker buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Available platforms
id: platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Log into registry ${{ env.REGISTRY }}
id: login
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GH_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=true
tags: |
type=schedule,pattern={{date 'YYYYMMDD'}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and Push
id: build-and-push
uses: docker/bake-action@v2
with:
files: |
./.github/workflows/docker-bake.hcl
${{ steps.meta.outputs.bake-file }}
targets: build
push: true
- name: Run Trivy vulnerability scanner
id: trivy
uses: aquasecurity/trivy-action@master
with:
image-ref: '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}'
format: 'sarif'
output: 'trivy-results.sarif'
ignore-unfixed: true
env:
TRIVY_USERNAME: ${{ github.actor }}
TRIVY_PASSWORD: ${{ secrets.GH_TOKEN }}
- name: Upload Trivy scan results to GitHub Security tab
id: sarif
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: 'trivy-results.sarif'