fix(): Migrates the image to DinD
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Elia el Lazkani 2023-07-03 00:18:50 +02:00
parent ebf56ec026
commit 90c5bf6354

View file

@ -38,21 +38,25 @@ steps:
repo: scm.project42.io/elia/blog repo: scm.project42.io/elia/blog
dry_run: true dry_run: true
squash: true squash: true
purge: false
tags: tags:
- "${DRONE_COMMIT_SHA:0:8}" - "${DRONE_COMMIT_SHA:0:8}"
depends_on: depends_on:
- clean-up-images - clean-up-images
- name: trivy-scan - name: trivy-scan
image: docker.io/aquasec/trivy:latest image: docker:dind
volumes: volumes:
- name: dockersock - name: dockersock
path: /var/run/docker.sock path: /var/run/docker.sock
commands: commands:
- export TRIVY_VERSION=$(wget -qO - "https://api.github.com/repos/aquasecurity/trivy/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
- echo "$TRIVY_VERSION"
- export TRIVY_URL=$(printf "https://github.com/aquasecurity/trivy/releases/download/v%s/trivy_%s_Linux-64bit.tar.gz" "$TRIVY_VERSION" "$TRIVY_VERSION")
- echo "$TRIVY_URL"
- wget --no-verbose "$TRIVY_URL" -O - | tar -zxvf -
- docker build -t "scm.project42.io/elia/blog:${DRONE_COMMIT_SHA:0:8}" . - docker build -t "scm.project42.io/elia/blog:${DRONE_COMMIT_SHA:0:8}" .
- trivy image --exit-code 0 "scm.project42.io/elia/blog:${DRONE_COMMIT_SHA:0:8}" - ./trivy image --exit-code 0 "scm.project42.io/elia/blog:${DRONE_COMMIT_SHA:0:8}"
- trivy image --exit-code 1 --severity CRITICAL "scm.project42.io/elia/blog:${DRONE_COMMIT_SHA:0:8}" - ./trivy image --exit-code 1 --severity CRITICAL "scm.project42.io/elia/blog:${DRONE_COMMIT_SHA:0:8}"
- docker rmi "scm.project42.io/elia/blog:${DRONE_COMMIT_SHA:0:8}" - docker rmi "scm.project42.io/elia/blog:${DRONE_COMMIT_SHA:0:8}"
depends_on: depends_on:
- test-build-container - test-build-container