Skip to content

Commit f3b4ada

Browse files
committed
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.
1 parent fd44c1b commit f3b4ada

1 file changed

Lines changed: 25 additions & 17 deletions

File tree

.github/workflows/test_build_push.yml

Lines changed: 25 additions & 17 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:
@@ -89,14 +95,16 @@ jobs:
8995
SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }}
9096
with:
9197
context: .
92-
push: true
98+
push: false
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,19 +113,19 @@ 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/sbom-action@v0.20.1
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-
120-
- name: Move updated cache into place
121-
run: |
122-
rm -rf /tmp/.buildx-cache
123-
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
116+
# - name: Generate SBOM
117+
# uses: anchore/sbom-action@v0.20.1
118+
# with:
119+
# image: gilcreator/html2rss-web:${{ github.sha }}
120+
# output-file: sbom.spdx.json
121+
122+
# - name: Upload SBOM Artifact
123+
# uses: actions/upload-artifact@v4
124+
# with:
125+
# name: sbom
126+
# path: sbom.spdx.json
127+
128+
# - name: Move updated cache into place
129+
# run: |
130+
# rm -rf /tmp/.buildx-cache
131+
# mv /tmp/.buildx-cache-new /tmp/.buildx-cache

0 commit comments

Comments
 (0)