Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trivy build fix #69

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file added .github/.DS_Store
Binary file not shown.
41 changes: 30 additions & 11 deletions .github/workflows/trivy-scanning.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,55 @@ jobs:

- name: Build images for nginx, web and db
run: |
docker build -t docker.io/xnat-docker-compose/xnat_docker_compose_xnat-nginx:${{ github.sha }} nginx/
docker build -t docker.io/xnat-docker-compose/xnat_docker_compose_xnat-web:${{ github.sha }} tomcat/
docker build -t docker.io/xnat-docker-compose/xnat_docker_compose_xnat-db:${{ github.sha }} postgres/
XNAT_NGINX_IMAGE=docker.io/xnat-docker-compose/xnat_docker_compose_xnat-nginx:${{ github.sha }} docker-compose build xnat-nginx
XNAT_WEB_IMAGE=docker.io/xnat-docker-compose/xnat_docker_compose_xnat-web:${{ github.sha }} docker-compose build xnat-web
XNAT_DB_IMAGE=docker.io/xnat-docker-compose/xnat_docker_compose_xnat-db:${{ github.sha }} docker-compose build xnat-db

- name: Create folder for the scanner results
run: mkdir results

- name: Run Trivy vulnerability scanner on nginx
uses: aquasecurity/trivy-action@master
with:
image-ref: 'docker.io/xnat-docker-compose/xnat_docker_compose_xnat-nginx:${{ github.sha }}'
format: 'table'
exit-code: '1'
# format: 'table'
# exit-code: '1'
format: 'template'
template: '@/contrib/sarif.tpl'
output: './results/trivy-results-nginx.sarif'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
continue-on-error: true
# continue-on-error: true

- name: Run Trivy vulnerability scanner on web
uses: aquasecurity/trivy-action@master
with:
image-ref: 'docker.io/xnat-docker-compose/xnat_docker_compose_xnat-web:${{ github.sha }}'
format: 'table'
exit-code: '1'
# format: 'table'
# exit-code: '1'
format: 'template'
template: '@/contrib/sarif.tpl'
output: './results/trivy-results-web.sarif'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
continue-on-error: true
# continue-on-error: true

- name: Run Trivy vulnerability scanner on postgres
uses: aquasecurity/trivy-action@master
with:
image-ref: 'docker.io/xnat-docker-compose/xnat_docker_compose_xnat-db:${{ github.sha }}'
format: 'table'
exit-code: '1'
# format: 'table'
# exit-code: '1'
format: 'template'
template: '@/contrib/sarif.tpl'
output: './results/trivy-results-db.sarif'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: './results'
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
version: '3.7'
services:
xnat-web:
image: ${XNAT_WEB_IMAGE:-xnat_docker_compose_xnat-web:latest}
build:
context: ./xnat
args:
Expand Down Expand Up @@ -35,6 +36,7 @@ services:
- XNAT_HOME=${XNAT_HOME}

xnat-db:
image: ${XNAT_DB_IMAGE:-xnat_docker_compose_xnat-db:latest}
build:
context: ./postgres
args:
Expand All @@ -47,11 +49,11 @@ services:
POSTGRES_PASSWORD: ${XNAT_DATASOURCE_ADMIN_PASSWORD}

xnat-nginx:
image: ${XNAT_NGINX_IMAGE:-xnat_docker_compose_xnat-nginx:latest}
build: ./nginx
ports:
- "80:80"
expose:
- "80"
links:
- xnat-web