@@ -945,34 +945,23 @@ analyze-cats-results: parse-cats-results query-cats-results ## Parse and query
945945# CONTAINER SECURITY AND BUILD MANAGEMENT
946946# ============================================================================
947947
948- .PHONY : build-containers build-container-db build-container-redis build-container-tmi build-container-oracle build-container-oracle-push build-container-redis-oracle build-container-redis-oracle-push build-containers-oracle build-containers-oracle-push scan-containers scan-trivy report-containers update-docker-scout
949-
950- # Update Docker Scout CLI
951- update-docker-scout :
952- $(call log_info,Updating Docker Scout CLI...)
953- @curl -fsSL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh -o install-scout.sh
954- @sh install-scout.sh
955- @rm -f install-scout.sh
956- $(call log_success,Docker Scout CLI updated successfully)
948+ .PHONY : build-containers build-container-db build-container-redis build-container-tmi build-container-oracle build-container-oracle-push build-container-redis-oracle build-container-redis-oracle-push build-containers-oracle build-containers-oracle-push scan-containers report-containers
957949
958950# Build PostgreSQL container only
959- build-container-db :
951+ build-container-db : check-grype
960952 $(call log_info,Building PostgreSQL container...)
961- @$(MAKE ) -f $(MAKEFILE_LIST ) update-docker-scout
962953 @./scripts/build-containers.sh postgresql
963954 $(call log_success,PostgreSQL container built successfully)
964955
965956# Build Redis container only
966- build-container-redis :
957+ build-container-redis : check-grype
967958 $(call log_info,Building Redis container...)
968- @$(MAKE ) -f $(MAKEFILE_LIST ) update-docker-scout
969959 @./scripts/build-containers.sh redis
970960 $(call log_success,Redis container built successfully)
971961
972962# Build TMI server container only
973- build-container-tmi :
963+ build-container-tmi : check-grype
974964 $(call log_info,Building TMI server container...)
975- @$(MAKE ) -f $(MAKEFILE_LIST ) update-docker-scout
976965 @./scripts/build-containers.sh application
977966 $(call log_success,TMI server container built successfully)
978967
@@ -1023,46 +1012,32 @@ build-containers: build-container-db build-container-redis build-container-tmi
10231012 $(call log_success,All containers built successfully)
10241013
10251014# Run security scan on existing containers
1026- scan-containers :
1015+ scan-containers : check-grype
10271016 $(call log_info,Running security scans on container images...)
1028- @$(MAKE ) -f $(MAKEFILE_LIST ) update-docker-scout
1029- @if ! command -v docker scout > /dev/null 2>&1 ; then \
1030- $(call log_error,Docker Scout not available after update. Installation may have failed) ; \
1031- exit 1; \
1032- fi
10331017 @mkdir -p security-reports
10341018 @echo " Scanning cgr.dev/chainguard/postgres:latest..."
1035- @docker scout cves cgr.dev/chainguard/postgres:latest --only-severity critical,high > security-reports/postgresql-scan.txt 2>&1 || true
1019+ @grype cgr.dev/chainguard/postgres:latest -o sarif > security-reports/postgresql-scan.sarif 2> /dev/null || true
1020+ @grype cgr.dev/chainguard/postgres:latest -o table > security-reports/postgresql-scan.txt 2>&1 || true
10361021 @echo " Scanning tmi/tmi-redis:latest..."
1037- @docker scout cves tmi/tmi-redis:latest --only-severity critical,high > security-reports/redis-scan.txt 2>&1 || true
1022+ @grype tmi/tmi-redis:latest -o sarif > security-reports/redis-scan.sarif 2> /dev/null || true
1023+ @grype tmi/tmi-redis:latest -o table > security-reports/redis-scan.txt 2>&1 || true
10381024 @if [ -f " Dockerfile.dev" ]; then \
10391025 echo " Building and scanning application image..." ; \
10401026 docker build -f Dockerfile.dev -t tmi-temp-scan:latest . > /dev/null 2>&1 || true ; \
1041- docker scout cves tmi-temp-scan:latest --only-severity critical,high > security-reports/application-scan.txt 2>&1 || true ; \
1027+ grype tmi-temp-scan:latest -o sarif > security-reports/application-scan.sarif 2> /dev/null || true ; \
1028+ grype tmi-temp-scan:latest -o table > security-reports/application-scan.txt 2>&1 || true ; \
10421029 docker rmi tmi-temp-scan:latest > /dev/null 2>&1 || true ; \
10431030 fi
10441031 $(call log_success,Security scans completed. Reports in security-reports/)
10451032
1046- # Run Trivy filesystem security scan
1047- scan-trivy :
1048- $(call log_info,Running Trivy filesystem security scan...)
1049- @if ! command -v trivy > /dev/null 2>&1 ; then \
1050- $(call log_error,Trivy not found. Please install it first.) ; \
1051- $(call log_info,See: https://aquasecurity.github.io/trivy/) ; \
1052- $(call log_info,On MacOS with Homebrew: brew install trivy) ; \
1053- exit 1; \
1054- fi
1055- @trivy fs --ignorefile ./.trivyignore.yaml .
1056- $(call log_success,Trivy filesystem scan completed)
1057-
10581033# Generate comprehensive security report
10591034report-containers : scan-containers
10601035 $(call log_info,Generating container security report...)
10611036 @mkdir -p security-reports
10621037 @echo " # TMI Container Security Report" > security-reports/security-summary.md
10631038 @echo " " >> security-reports/security-summary.md
10641039 @echo " **Generated:** $$ (date)" >> security-reports/security-summary.md
1065- @echo " **Scanner:** Docker Scout " >> security-reports/security-summary.md
1040+ @echo " **Scanner:** Grype (Anchore) " >> security-reports/security-summary.md
10661041 @echo " " >> security-reports/security-summary.md
10671042 @echo " ## Vulnerability Summary" >> security-reports/security-summary.md
10681043 @echo " " >> security-reports/security-summary.md
@@ -1375,7 +1350,7 @@ clean-wstest:
13751350# SBOM GENERATION - Software Bill of Materials
13761351# ============================================================================
13771352
1378- .PHONY : check-cyclonedx check-syft generate-sbom generate-sbom-all build-with-sbom build-server-sbom
1353+ .PHONY : check-cyclonedx check-syft check-grype generate-sbom generate-sbom-all build-with-sbom build-server-sbom
13791354
13801355# Check for cyclonedx-gomod (Go components)
13811356check-cyclonedx :
@@ -1401,6 +1376,18 @@ check-syft:
14011376 fi
14021377 @$(call log_success,Syft is available)
14031378
1379+ # Check for Grype (container vulnerability scanning)
1380+ check-grype :
1381+ @if ! command -v grype > /dev/null 2>&1 ; then \
1382+ $(call log_error,Grype not found) ; \
1383+ echo " " ; \
1384+ $(call log_info,Install using:) ; \
1385+ echo " Homebrew: brew install grype" ; \
1386+ echo " Script: curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin" ; \
1387+ exit 1; \
1388+ fi
1389+ @$(call log_success,Grype is available)
1390+
14041391# Generate SBOM for Go application only
14051392generate-sbom : check-cyclonedx
14061393 $(call log_info,Generating SBOM for Go application...)
@@ -1618,8 +1605,8 @@ help:
16181605 @echo " reset-db-oci - Drop all tables in OCI ADB (destructive)"
16191606 @echo " clean-dev - Clean development environment"
16201607 @echo " "
1621- @echo " Container Management (Docker Scout Integration):"
1622- @echo " update-docker-scout - Update Docker Scout CLI to latest version "
1608+ @echo " Container Management (Grype Integration):"
1609+ @echo " check-grype - Verify Grype vulnerability scanner is installed "
16231610 @echo " build-container-db - Build PostgreSQL container only"
16241611 @echo " build-container-redis - Build Redis container only"
16251612 @echo " build-container-tmi - Build TMI server container only"
@@ -1631,7 +1618,6 @@ help:
16311618 @echo " build-containers-oracle-push - Build and push all Oracle containers"
16321619 @echo " build-containers - Build all containers (db, redis, tmi serially)"
16331620 @echo " scan-containers - Scan existing containers for vulnerabilities"
1634- @echo " scan-trivy - Run Trivy filesystem security scan"
16351621 @echo " report-containers - Generate comprehensive security report"
16361622 @echo " start-containers-environment - Start development with containers"
16371623 @echo " build-containers-all - Run full container build and report"
0 commit comments