Skip to content

Commit f14e941

Browse files
authored
ci: build amd64+arm64 docker images incl. SBOM (#744)
* ci: build docker images for amd64+arm64 * comment out if / skip condition * use recent version of aquasecurity/trivy-action * generate sbom and upload+inline Signed-off-by: Gil Desmarais <[email protected]> * fix order * tag images with sha Signed-off-by: Gil Desmarais <[email protected]> * let's go. comment in if and push. * add note on sbom --------- Signed-off-by: Gil Desmarais <[email protected]>
1 parent 34b6e37 commit f14e941

File tree

3 files changed

+65
-12
lines changed

3 files changed

+65
-12
lines changed

.github/workflows/test_build_push.yml

Lines changed: 64 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,69 @@ jobs:
5050
- hadolint
5151
- ruby
5252
runs-on: ubuntu-latest
53+
permissions:
54+
contents: read
55+
packages: write
56+
env:
57+
IMAGE_NAME: gilcreator/html2rss-web
58+
TAG_SHA: ${{ github.sha }}
5359
steps:
54-
- uses: actions/checkout@v4
55-
- run: bin/docker-build
60+
- name: Checkout code
61+
uses: actions/checkout@v4
62+
63+
- name: Set up QEMU
64+
uses: docker/setup-qemu-action@v3
65+
66+
- name: Set up Docker Buildx
67+
uses: docker/setup-buildx-action@v3
68+
69+
- name: Log in to DockerHub
70+
uses: docker/login-action@v3
71+
with:
72+
username: ${{ secrets.DOCKER_USERNAME }}
73+
password: ${{ secrets.DOCKER_PASSWORD }}
74+
75+
- name: Cache Docker layers
76+
uses: actions/cache@v4
77+
with:
78+
path: /tmp/.buildx-cache
79+
key: ${{ runner.os }}-buildx-${{ github.sha }}
80+
restore-keys: |
81+
${{ runner.os }}-buildx-
82+
83+
- name: Build and push Docker image
84+
uses: docker/build-push-action@v5
85+
with:
86+
context: .
87+
push: true
88+
tags: |
89+
gilcreator/html2rss-web:latest
90+
gilcreator/html2rss-web:${{ github.sha }}
91+
platforms: linux/amd64,linux/arm64
92+
cache-from: type=local,src=/tmp/.buildx-cache
93+
cache-to: type=local,dest=/tmp/.buildx-cache-new
94+
provenance: true
95+
labels: |
96+
org.opencontainers.image.source=https://github.com/${{ github.repository }}
97+
org.opencontainers.image.created=${{ github.event.head_commit.timestamp }}
98+
org.opencontainers.image.revision=${{ github.sha }}
99+
org.opencontainers.image.title=html2rss-web
100+
org.opencontainers.image.description=Generates RSS feeds of any website & serves to the web!
101+
org.opencontainers.image.sbom=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts
102+
103+
- name: Generate SBOM
104+
uses: anchore/[email protected]
105+
with:
106+
image: gilcreator/html2rss-web:${{ github.sha }}
107+
output-file: sbom.spdx.json
108+
109+
- name: Upload SBOM Artifact
110+
uses: actions/upload-artifact@v4
111+
with:
112+
name: sbom
113+
path: sbom.spdx.json
56114

57-
- run: bin/docker-push
58-
env:
59-
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
60-
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
115+
- name: Move updated cache into place
116+
run: |
117+
rm -rf /tmp/.buildx-cache
118+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ Please refer to [html2rss' README for a description of _the feed config and its
137137
This web application is distributed in a [rolling release](https://en.wikipedia.org/wiki/Rolling_release) fashion from the `master` branch.
138138

139139
For the latest commit passing GitHub CI/CD on the master branch, an updated Docker image will be pushed to [Docker Hub: `gilcreator/html2rss-web`](https://hub.docker.com/r/gilcreator/html2rss-web).
140+
The [SBOM](https://en.wikipedia.org/wiki/Software_supply_chain) is embedded as an OCI label in the Docker image and is [also available as a build artifact](https://github.com/html2rss/html2rss-web/actions/workflows/test_build_push.yml?query=branch%3Amaster).
140141

141142
GitHub's @dependabot is enabled for dependency updates and they are automatically merged to the `master` branch when the CI gives the green light.
142143

bin/docker-push

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)