ci: add devsecops scan and automated deployment pipeline

This commit is contained in:
mahdi 2026-07-19 22:51:45 +03:30
parent 8137b9c61f
commit d4724a8e0d
1 changed files with 27 additions and 0 deletions

27
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,27 @@
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