Skip to content

Commit 8352eb4

Browse files
authored
Merge pull request #2436 from aboutcode-org/docker-publish
Add workflow to publish VulnerableCode docker image
2 parents 7498cca + 47cf62a commit 8352eb4

3 files changed

Lines changed: 75 additions & 0 deletions

File tree

‎.dockerignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,6 @@ README.rst
3232
# Ignore virtualenv and local Python build files
3333
**/venv
3434
**/*.egg-info
35+
36+
# Ignore VulnTotal
37+
**/vulntotal
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Create and publish Docker image on GHCR
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- "v*.*.*"
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}
12+
13+
jobs:
14+
build-and-push-image:
15+
runs-on: ubuntu-24.04
16+
17+
permissions:
18+
contents: read
19+
packages: write
20+
attestations: write
21+
id-token: write
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
26+
27+
- name: Log in to the Container registry
28+
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
29+
with:
30+
registry: ${{ env.REGISTRY }}
31+
username: ${{ github.actor }}
32+
password: ${{ secrets.GITHUB_TOKEN }}
33+
34+
- name: Extract metadata (tags, labels) for Docker
35+
id: meta
36+
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
37+
with:
38+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
39+
tags: |
40+
type=semver,pattern={{version}}
41+
labels: |
42+
org.opencontainers.image.title=VulnerableCode
43+
org.opencontainers.image.description=A free and open vulnerability database with tools to track, aggregate, and correlate package vulnerabilities
44+
org.opencontainers.image.licenses=Apache-2.0
45+
annotations: |
46+
org.opencontainers.image.title=VulnerableCode
47+
org.opencontainers.image.description=A free and open vulnerability database with tools to track, aggregate, and correlate package vulnerabilities
48+
org.opencontainers.image.licenses=Apache-2.0
49+
50+
- name: Set up Docker Buildx
51+
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0
52+
53+
- name: Build and push Docker image
54+
id: push
55+
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
56+
with:
57+
context: .
58+
push: true
59+
tags: ${{ steps.meta.outputs.tags }}
60+
labels: ${{ steps.meta.outputs.labels }}
61+
annotations: ${{ steps.meta.outputs.annotations }}
62+
provenance: false
63+
64+
- name: Generate artifact attestation
65+
uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
66+
with:
67+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
68+
subject-digest: ${{ steps.push.outputs.digest }}
69+
push-to-registry: true
70+

‎.github/workflows/pypi-release.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ jobs:
5050
needs:
5151
- build-pypi-distribs
5252
runs-on: ubuntu-24.04
53+
permissions:
54+
contents: write
5355

5456
steps:
5557
- name: Download built archives

0 commit comments

Comments
 (0)