Skip to content

A complete DevSecOps CI/CD automation pipeline for a Node.js application using GitHub Actions, Docker, Trivy security scanning, and Kubernetes (Minikube), implementing shift-left security and cloud-native deployment practices.

License

Notifications You must be signed in to change notification settings

RoshaneAnees/devsecops

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘οΈ DevSecOps Automation Pipeline

Secure CI/CD with GitHub Actions, Trivy & Kubernetes (Minikube)

DevSecOps GitHub Actions Docker Kubernetes Security


πŸ“– Project Overview

This repository demonstrates a complete DevSecOps automation pipeline developed as part of an Advanced Cloud Computing course.

The project automates the entire lifecycle of a Node.js application β€” from source code commit to secure deployment β€” while enforcing security at every stage using a Shift-Left DevSecOps approach.

The pipeline runs on a Self-Hosted GitHub Actions Runner and deploys the application to a local Kubernetes cluster (Minikube).


🎯 What We Achieved

βœ” Fully automated CI/CD pipeline
βœ” Integrated security scanning (DevSecOps)
βœ” Containerized application delivery
βœ” Kubernetes-based deployment
βœ” Real-world cloud-native workflow


πŸ—οΈ Architecture & Workflow

graph LR
    A[πŸ’» Developer Pushes Code] --> B[πŸ”¨ Build Docker Image]
    B --> C{πŸ›‘οΈ Trivy Security Scan}
    C -->|Pass| D[πŸ“¦ Push Image to GHCR]
    C -->|Fail| X[❌ Pipeline Stops]
    D --> E[πŸš€ Deploy to Kubernetes]
    E --> F[🌐 Application Exposed]
Loading

πŸ”„ Pipeline Stages Explained

  1. Source Code Commit
    Developer pushes code to GitHub.

  2. Semantic Versioning
    Automatically generates version tags (e.g. v1.0.1) based on commit history.

  3. Docker Image Build
    Builds a lightweight and optimized container image.

  4. Security Scanning (Trivy)

    • Scans image for CRITICAL and HIGH vulnerabilities
    • Pipeline fails immediately if vulnerabilities are detected
  5. Image Registry (GHCR)
    Securely pushes verified images to GitHub Container Registry.

  6. Kubernetes Deployment
    Performs rolling updates on Minikube using Kubernetes manifests.


πŸ› οΈ Technology Stack

Layer Technology Purpose
Source Control GitHub Version control & collaboration
CI/CD GitHub Actions Automated pipeline
Containerization Docker Application packaging
Registry GHCR Secure image storage
Orchestration Kubernetes (Minikube) Container deployment
Security Trivy Vulnerability scanning
Backend Node.js + Express Application logic
Runner Self-Hosted Runner Full environment control

πŸš€ Getting Started

βœ… Prerequisites

Ensure the following tools are installed:

  • Docker
  • Minikube
  • kubectl
  • Git

πŸ“₯ Installation

# Clone the repository
git clone https://github.com/RoshaneAnees/devsecops.git
cd devsecops

# Start Minikube
minikube start --driver=docker

# Verify cluster
kubectl get nodes

🚒 Deployment

Deployment is fully automated via GitHub Actions.

For manual testing:

kubectl apply -f k8s/

πŸ”’ Security Implementation (DevSecOps Core)

Security is embedded, not optional.

  • πŸ” Scanner: Trivy (Aqua Security)
  • 🎯 Target: Docker image
  • 🚨 Severity Gate: CRITICAL & HIGH
  • β›” Policy: Pipeline stops on detection

This ensures no vulnerable container reaches production.


🌐 Accessing the Application

Check Pod Status

kubectl get pods

Access via Minikube

minikube service devsecops-svc --url

Port Forward (Alternative)

kubectl port-forward svc/devsecops-svc 3000:3000

Visit:
πŸ‘‰ http://localhost:3000


πŸ“‚ Repository Structure

devsecops/
β”œβ”€β”€ .github/workflows/
β”‚   └── cicd.yaml        # βš™οΈ CI/CD Pipeline
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ Dockerfile       # 🐳 Docker image definition
β”‚   β”œβ”€β”€ package.json     # πŸ“¦ Dependencies
β”‚   └── index.js         # ⚑ Application entry point
β”œβ”€β”€ k8s/
β”‚   β”œβ”€β”€ deployment.yaml  # ☸️ Kubernetes deployment
β”‚   └── service.yaml     # 🌐 Service exposure
└── README.md            # πŸ“„ Documentation

🌍 Real-World & Cloud Computing Relevance

This project directly maps to industry-grade cloud practices:

  • Mirrors enterprise DevSecOps pipelines
  • Implements container security gates
  • Uses cloud-native orchestration
  • Demonstrates CI/CD + Kubernetes integration
  • Applies Shift-Left security principles

🧠 Why This Project Matters

Traditional DevOps focuses on speed.
DevSecOps adds trust, safety, and compliance.

This project proves:

  • Security can be automated
  • CI/CD can be secure by design
  • Cloud deployments can be reliable & scalable

πŸ‘¨β€πŸ’» Author

Roshane Anees

DevSecOps Automation Project
Advanced Cloud Computing β€’ Fall 2026


⭐ If you found this project useful, consider starring the repository!

About

A complete DevSecOps CI/CD automation pipeline for a Node.js application using GitHub Actions, Docker, Trivy security scanning, and Kubernetes (Minikube), implementing shift-left security and cloud-native deployment practices.

Topics

Resources

License

Stars

Watchers

Forks

Packages