Skip to content

Commit 977f088

Browse files
authored
ci(docker): extract metadata and enable sbom in build (#746)
* ci(docker): extract metadata enable sbom in build Integrates `docker/metadata-action` to extract image metadata and use its outputs for tagging. Enables SBOM generation to enhance security and compliance. Improves image tagging by including metadata outputs and retains multi-platform support. https://docs.docker.com/build/ci/github-actions/attestations/
1 parent fd44c1b commit 977f088

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

.github/workflows/test_build_push.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ jobs:
6969
- name: Get Git commit timestamps
7070
run: echo "TIMESTAMP=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV
7171

72+
- name: Extract metadata
73+
id: meta
74+
uses: docker/metadata-action@v5
75+
with:
76+
images: ${{ env.IMAGE_NAME }}
77+
7278
- name: Log in to DockerHub
7379
uses: docker/login-action@v3
7480
with:
@@ -93,10 +99,12 @@ jobs:
9399
tags: |
94100
gilcreator/html2rss-web:latest
95101
gilcreator/html2rss-web:${{ github.sha }}
102+
${{ steps.meta.outputs.tags }}
96103
platforms: linux/amd64,linux/arm64
97104
cache-from: type=local,src=/tmp/.buildx-cache
98105
cache-to: type=local,dest=/tmp/.buildx-cache-new
99106
provenance: true
107+
sbom: true
100108
labels: |
101109
org.opencontainers.image.source=https://github.com/${{ github.repository }}
102110
org.opencontainers.image.created=${{ github.event.head_commit.timestamp }}
@@ -105,18 +113,6 @@ jobs:
105113
org.opencontainers.image.description=Generates RSS feeds of any website & serves to the web!
106114
org.opencontainers.image.sbom=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts
107115
108-
- name: Generate SBOM
109-
uses: anchore/[email protected]
110-
with:
111-
image: gilcreator/html2rss-web:${{ github.sha }}
112-
output-file: sbom.spdx.json
113-
114-
- name: Upload SBOM Artifact
115-
uses: actions/upload-artifact@v4
116-
with:
117-
name: sbom
118-
path: sbom.spdx.json
119-
120116
- name: Move updated cache into place
121117
run: |
122118
rm -rf /tmp/.buildx-cache

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +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).
140+
The [SBOM](https://en.wikipedia.org/wiki/Software_supply_chain) is embedded in the Docker image.
141141

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

0 commit comments

Comments
 (0)