A simple Node.js web application demonstrating CI/CD concepts with Jenkins and Docker.
- Continuous Integration: Automated testing on every code change
- Continuous Deployment: Automated deployment pipeline
- Jenkins Pipeline: Complete CI/CD workflow using Jenkinsfile
- Docker: Jenkins running in a containerized environment
- Automated Testing: Jest unit tests with CI integration
simple-cicd-demo/
├── app.js # Express.js web application
├── app.test.js # Jest unit tests
├── package.json # Node.js dependencies and scripts
├── Jenkinsfile # Jenkins pipeline configuration
├── .gitignore # Git ignore rules
└── README.md # This documentation
- Node.js 18+ (we use 24.4.1 in CI)
- npm package manager
# Install dependencies
npm install
# Run tests
npm test
# Start the application
npm startnpm start- Start the Express server on port 3000npm test- Run Jest test suite
-
GET / - Returns hello world message with timestamp
{ "message": "Hello CI/CD World!", "version": "1.0.0", "timestamp": "2025-01-17T15:30:45.123Z" } -
GET /health - Health check endpoint
{ "status": "healthy", "uptime": 47.8329652 }
Our Jenkins pipeline includes these automated stages:
- 📥 Checkout - Get latest code from GitHub
- ⚙️ Setup - Verify Node.js 24.4.1 environment
- 📦 Install Dependencies - Run
npm install - 🧪 Run Tests - Execute Jest unit tests
- 🏗️ Build - Prepare application for deployment
- 🚀 Deploy to Staging - Simulate deployment process
The pipeline is defined in Jenkinsfile and includes:
- Automatic Node.js 24.4.1 installation
- Dependency caching
- Test result reporting
- Build artifacts
- Deployment simulation
| Technology | Purpose |
|---|---|
| Node.js 24.4.1 | Runtime environment |
| Express.js | Web framework |
| Jest | Testing framework |
| Supertest | HTTP testing utilities |
| Jenkins | CI/CD automation platform |
| Docker | Container platform for Jenkins |
| Git/GitHub | Version control and source hosting |
git clone https://github.com/b95702041/simple-cicd-demo.git
cd simple-cicd-demonpm install
npm test
npm start- Install Docker Desktop
- Run Jenkins in Docker:
docker run -d -p 8080:8080 -p 50000:50000 -v jenkins_home:/var/jenkins_home --name jenkins jenkins/jenkins:lts
- Access Jenkins: http://localhost:8080
- Install NodeJS Plugin
- Configure Node.js 24.4.1 tool
- Create Pipeline job pointing to this repository
Latest Build Status: ✅ SUCCESS
✅ Node.js: v24.4.1
✅ npm: v11.4.2
✅ Dependencies: 346 packages installed
✅ Tests: 2/2 passing
✅ Build: Completed successfully
✅ Deployment: Simulated successfully
Test Suites: 1 passed, 1 total
Tests: 2 passed, 2 total
Snapshots: 0 total
Time: 1.672 s
- ✅ GET / returns correct hello message
- ✅ GET /health returns healthy status
This project demonstrates:
- Setting up a complete CI/CD pipeline from scratch
- Automated testing integration
- Docker containerization for development tools
- Git workflow with automated builds
- Jenkins pipeline configuration
- Node.js application development and testing
- Developer pushes code → GitHub repository
- Jenkins detects changes → Triggers pipeline
- Pipeline runs automatically → Tests, builds, deploys
- Results reported → Success/failure notifications
- Application deployed → Ready for use
To extend this project, consider:
- Adding more comprehensive tests
- Implementing real deployment to cloud platforms
- Adding code quality checks (linting, security scans)
- Setting up multiple environments (dev, staging, production)
- Adding notification integrations (Slack, email)
- Implementing blue-green deployments
Created as a hands-on learning exercise for CI/CD concepts with Jenkins and Docker.
For questions or improvements, please open an issue or submit a pull request.