How shubha03/ci-cd-pipeline works
Project type and purpose
• This is a single‐service Python web application whose primary purpose is to demonstrate a full CI/CD pipeline.
• It uses GitHub Actions to build, test, and push a Docker image; Docker to containerize the app; and a local Kubernetes cluster (Minikube) to deploy and run the container.
File structure
• Top level:
• .github/workflows/ci-cd.yml → GitHub Actions workflow definition
• Dockerfile → instructions to build the app container
• app.py → the Python web service entry point
• requirements.txt → Python dependencies
• k8s/deployment.yaml & k8s/service.yaml → Kubernetes manifests for Deployment and Service
• No separate “frontend” directory—this is a backend/microservice demonstration.
• CI/CD‐related files are cleanly isolated under .github.
README for additional insights
• The README confirms the use of GitHub Actions for CI/CD, Docker for containerization, and Kubernetes (Minikube) for local deployment and testing.
Main components & their interactions
a. Components:
1. Developer workstation (pushes code)
2. GitHub repository & GitHub Actions runner
3. Docker build & registry (Docker Hub or GitHub Container Registry)
4. Minikube Kubernetes cluster (with a Node, Docker runtime inside)
5. Kubernetes objects: Deployment (running pods with the container), Service (exposes pods)
6. End user or API client
b. Relationships & data flows:
• Code push → triggers GitHub Actions
• Actions → runs lint/tests, builds Docker image → pushes to registry
• Actions (or manual kubectl) → applies k8s manifests to Minikube
• Kubernetes → pulls the image from registry, schedules pods
• Service → routes external HTTP traffic to app pods
• Client → sends HTTP requests to the Service’s endpoint
c. Architectural patterns & design principles:
• CI/CD pipeline as code (GitHub Actions)
• Containerization (Docker) for environment consistency
• Declarative infrastructure (Kubernetes manifests)
• Single responsibility microservice
d. Key technologies/frameworks:
• GitHub Actions
• Docker
• Python (Flask, FastAPI, or built-in HTTP server in app.py)
• Kubernetes (Deployment, Service)
• Minikube for local cluster
Detailed breakdown for maximum clarity
• Leftmost lane: Developer commits → GitHub Repository
• Middle lane: GitHub Actions → Tests → Docker Build → Docker Push
• Rightmost lane: Minikube Cluster → Kubernetes API → Deployment → Pods → Service → Client
• Kubernetes objects:
• Deployment (specifies replicas, image)
• Service (ClusterIP or NodePort)