-
-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attach sbom to container image (#730)
* Test oras sbom attach Signed-off-by: Prabhu Subramanian <[email protected]> * Tweaks Signed-off-by: Prabhu Subramanian <[email protected]> --------- Signed-off-by: Prabhu Subramanian <[email protected]>
- Loading branch information
Showing
5 changed files
with
69 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
**/.git | ||
.github/ | ||
.vscode/ | ||
**/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Attach signed SBOM to a container image | ||
|
||
## Learning Objective | ||
|
||
In this lesson, we will learn about signing and attaching a signed SBOM to a container image. | ||
|
||
## Pre-requisites | ||
|
||
Ensure the following tools are installed. | ||
|
||
- ORAS [CLI](https://oras.land/docs/installation) | ||
- Node.js > 18 | ||
- docker or podman | ||
|
||
Additionally, you need to have access to a container registry to push the image. | ||
|
||
## Getting started | ||
|
||
Install cdxgen | ||
|
||
```shell | ||
sudo npm install -g @cyclonedx/cdxgen | ||
``` | ||
|
||
### Create and Build a container image | ||
|
||
Paste the below contents to a file named `Dockerfile` | ||
|
||
``` | ||
FROM ubuntu:latest | ||
``` | ||
|
||
Build and push the image to the registry | ||
|
||
```shell | ||
docker build -t docker.io/<repo>/sign-test:latest -f Dockerfile . | ||
docker push docker.io/<repo>/sign-test:latest | ||
``` | ||
|
||
### Create an SBOM with cdxgen | ||
|
||
```shell | ||
cdxgen --generate-key-and-sign -t docker -o bom.json docker.io/<repo>/sign-test:latest | ||
oras attach --artifact-type sbom/cyclonedx docker.io/<repo>/sign-test:latest ./bom.json:application/json | ||
oras discover -o tree docker.io/<repo>/sign-test:latest | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters