This repository has been archived by the owner on Sep 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (105 loc) · 3.36 KB
/
saveweb.yml
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: saveweb Images CI
on:
push:
branches:
- 'master'
paths:
- '.github/workflows/saveweb.yml'
- './lowapk-v2.Dockerfile'
schedule:
- cron: "30 1 * * *"
workflow_dispatch:
env:
REGISTRY_IMAGE: ${{ secrets.DOCKERHUB_USERNAME }}/saveweb
jobs:
lowapk-v2:
name: lowapk-v2
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
include:
- tag: saveweb:lowapk-v2-amd
dockerfile: "./lowapk-v2.Dockerfile"
platforms: linux/amd64
- tag: saveweb:lowapk-v2-arm
dockerfile: "./lowapk-v2.Dockerfile"
platforms: linux/arm64
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push by digest
id: build
uses: docker/build-push-action@v6
with:
push: true
file: ${{ matrix.dockerfile }}
platforms: ${{ matrix.platforms }}
cache-from: type=gha,scope=${{ matrix.platforms }}
cache-to: type=gha,mode=max,scope=${{ matrix.platforms }}
outputs: type=image,compression=estargz,force-compression=true,oci-mediatypes=true,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
-
name: Export digest
run: |
mkdir -p /tmp/lowapk-v2-digests/
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/lowapk-v2-digests/${digest#sha256:}"
platform=${{ matrix.platforms }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
-
name: Upload digest
uses: actions/upload-artifact@v4
with:
name: lowapk-v2-digests-${{ env.PLATFORM_PAIR }}
path: /tmp/lowapk-v2-digests/*
if-no-files-found: error
retention-days: 1
lowapk-v2-multiarch:
runs-on: ubuntu-24.04
needs:
- lowapk-v2
steps:
-
name: Download digests
uses: actions/download-artifact@v4
with:
path: /tmp/lowapk-v2-digests/
pattern: lowapk-v2-digests-*
merge-multiple: true
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Create manifest list and push
working-directory: /tmp/lowapk-v2-digests/
run: |
docker buildx imagetools create --tag ${{ env.REGISTRY_IMAGE }}:lowapk-v2 \
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
-
name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:lowapk-v2 \
| grep -Po '[^ \r\n\t\v]+@sha256:[a-z0-9]+' | xargs -r -t -n 1 docker buildx imagetools inspect --raw
-
name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
with:
image-ref: "${{ env.REGISTRY_IMAGE }}:lowapk-v2"
format: 'table'