Skip to content

Instantly share code, notes, and snippets.

@axelpavageau
Created February 3, 2021 11:05
Show Gist options
  • Save axelpavageau/d10d657a2afd40faeb536142dc443687 to your computer and use it in GitHub Desktop.
Save axelpavageau/d10d657a2afd40faeb536142dc443687 to your computer and use it in GitHub Desktop.
sample dind pipeline with trivy
stages:
- test
trivy:
stage: test
image: ekino/ci-dind:latest
services:
- name: docker:dind
entrypoint: ["env", "-u", "DOCKER_HOST"]
command: ["dockerd-entrypoint.sh"]
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
IMAGE: trivy-ci-test:$CI_COMMIT_SHA
script:
# Build image
- docker build -t $IMAGE .
# Print report
- trivy --exit-code 0 --cache-dir .trivycache/ --no-progress --severity HIGH $IMAGE
# Fail on severe vulnerabilities
- trivy --exit-code 1 --cache-dir .trivycache/ --severity CRITICAL --no-progress $IMAGE
cache:
paths:
- .trivycache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment