diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..80df616 --- /dev/null +++ b/.gitlab-ci.yml @@ -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 \ No newline at end of file