diff --git a/Containerfile b/Containerfile new file mode 100644 index 0000000..e4cd7e2 --- /dev/null +++ b/Containerfile @@ -0,0 +1,10 @@ +FROM ibmjava:11-jdk + +WORKDIR /tmp + +# use jar to unzip file in order to avoid having to install more dependencies +RUN jar -xvf hermeto-output/deps/generic/dependency-check.zip + +RUN chmod +x dependency-check/bin/dependency-check.sh + +ENTRYPOINT ["/tmp/dependency-check/bin/dependency-check.sh", "--version"] \ No newline at end of file diff --git a/README.md b/README.md index e93574a..2aaca1f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,28 @@ -# Repo of examples for Hermeto docs +# Generic fetcher example -Individual examples each live in their own branch (e.g. the basic `pip` example is in -the 'pip-basic' branch) +This example demonstrates using Hermeto's generic fetcher to build a container image with OWASP Dependency-Check tool. + +## Pre-fetch dependencies + +The `artifacts.lock.yaml` file specifies which files to download. Run Hermeto to fetch the dependencies: + +```shell +hermeto fetch-deps --source . --output ./hermeto-output generic +``` + +## Build the container image + +Build the container image while mounting the Hermeto output directory: + +```shell +podman build . \ + --volume "$(realpath ./hermeto-output)":/tmp/hermeto-output \ + --network none \ + --tag dependency-check-example +``` + +## Run the container + +```shell +podman run dependency-check-example +``` diff --git a/artifacts.lock.yaml b/artifacts.lock.yaml new file mode 100644 index 0000000..ba0e860 --- /dev/null +++ b/artifacts.lock.yaml @@ -0,0 +1,7 @@ +--- +metadata: + version: "1.0" +artifacts: + - download_url: "https://github.com/jeremylong/DependencyCheck/releases/download/v11.1.0/dependency-check-11.1.0-release.zip" + checksum: "sha256:c5b5b9e592682b700e17c28f489fe50644ef54370edeb2c53d18b70824de1e22" + filename: "dependency-check.zip"