Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/trivy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build and Scan Docker Images

on:
push:
branches:
- develop
pull_request:
branches:
- develop

jobs:
build-dockers:
strategy:
matrix:
include:
- SERVICE_LOCATION: 'admin/admin-service'
SERVICE_NAME: 'admin-service'
BUILD_ARTIFACT: 'admin'
- SERVICE_LOCATION: 'admin/hotlist-service'
SERVICE_NAME: 'hotlist-service'
BUILD_ARTIFACT: 'admin'
- SERVICE_LOCATION: 'admin/kernel-masterdata-service'
SERVICE_NAME: 'kernel-masterdata-service'
BUILD_ARTIFACT: 'admin'
- SERVICE_LOCATION: 'admin/kernel-syncdata-service'
SERVICE_NAME: 'kernel-syncdata-service'
BUILD_ARTIFACT: 'admin'
fail-fast: false
name: ${{ matrix.SERVICE_NAME }}
uses: mosip/kattu/.github/workflows/docker-build.yml@master
with:
SERVICE_LOCATION: ${{ matrix.SERVICE_LOCATION }}
SERVICE_NAME: ${{ matrix.SERVICE_NAME }}
BUILD_ARTIFACT: ${{ matrix.BUILD_ARTIFACT }}
secrets:
DEV_NAMESPACE_DOCKER_HUB: ${{ secrets.DEV_NAMESPACE_DOCKER_HUB }}

scan-dockers:
needs: build-dockers
runs-on: ubuntu-latest
strategy:
matrix:
include:
- SERVICE_NAME: 'admin-service'
- SERVICE_NAME: 'hotlist-service'
- SERVICE_NAME: 'kernel-masterdata-service'
- SERVICE_NAME: 'kernel-syncdata-service'
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install Trivy
run: |
sudo apt-get update
sudo apt-get install -y wget apt-transport-https gnupg lsb-release
wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | sudo apt-key add -
echo deb https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main | sudo tee -a /etc/apt/sources.list.d/trivy.list
sudo apt-get update
sudo apt-get install -y trivy

- name: Scan Docker image
run: trivy image ${{ secrets.DEV_NAMESPACE_DOCKER_HUB }}/${{ matrix.SERVICE_NAME }}:latest