Skip to content

Commit 2e2cc99

Browse files
add example
1 parent d83a044 commit 2e2cc99

File tree

3 files changed

+586
-0
lines changed

3 files changed

+586
-0
lines changed

example/example.bash

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
# chmod +x example.bash
4+
# ./example.bash docker.io/nginx:latest
5+
6+
DOCKER_IMAGE_NAME=$1
7+
8+
docker pull ${DOCKER_IMAGE_NAME}
9+
10+
docker run --rm ghcr.io/rootshell-coder/trivy-cached:latest image ${DOCKER_IMAGE_NAME} --skip-db-update > ./example.report.txt

example/example.gitlab-ci.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
stages:
3+
- runner_test
4+
5+
image: docker:dind
6+
7+
services:
8+
- name: docker:dind
9+
alias: docker
10+
11+
variables:
12+
DOCKER_HOST: tcp://docker:2376
13+
DOCKER_DRIVER: overlay2
14+
DOCKER_TLS_CERTDIR: "/certs"
15+
16+
DOCKER_IMAGE_NAME:
17+
value: ""
18+
description: "docker image name to scan. Full path with host and tag (:latest if tag is unknown)"
19+
20+
runner_test:
21+
stage: runner_test
22+
tags:
23+
- dind_runner
24+
script:
25+
- echo ${DOCKER_IMAGE_NAME}
26+
- docker pull ${DOCKER_IMAGE_NAME}
27+
- |+
28+
docker run --rm \
29+
ghcr.io/rootshell-coder/trivy-cached:latest \
30+
image ${DOCKER_IMAGE_NAME} --skip-db-update > ./report.txt
31+
artifacts:
32+
paths:
33+
- report.txt
34+
expire_in: 1 day
35+
rules:
36+
- if: $DOCKER_IMAGE_NAME != ""
37+
when: on_success
38+
- when: never

0 commit comments

Comments
 (0)