my-devops-client/.gitlab-ci.yml

27 lines
988 B
YAML

stages:
- test
- deploy
# -----------------------------------------------------------------
# Stage 1: DevSecOps Vulnerability Scanning
# -----------------------------------------------------------------
security_scan:
stage: test
image:
name: aquasec/trivy:0.49.1
entrypoint: [""]
script:
# Scan the application docker image for High and Critical vulnerabilities
- trivy image --severity HIGH,CRITICAL nginxdemos/hello:plain-text
# -----------------------------------------------------------------
# Stage 2: Automated GitOps Deployment
# -----------------------------------------------------------------
deploy_application:
stage: deploy
image: docker:24.0.7-cli
script:
# FIXED: Added the missing hyphen below to make it a proper list item
- docker pull nginxdemos/hello:plain-text
# Deploy the stack directly onto the host using the shared docker.sock
- docker compose -f ../../stacks/applications/hello-world/docker-compose.yml up -d