This is a simple Node.js application that demonstrates how to set up a CI/CD pipeline using GitHub Actions and DockerHub. The pipeline automatically builds, tests, and deploys the Docker image to DockerHub whenever changes are pushed to the main branch.
๐ GitHub Repository ๐ GitHub: jaspreet237/nodejs-demo-app
๐ Youtube Link : https://youtube.com/shorts/Ys0DX15pdaA?feature=share
๐ Tech Stack
- Node.js (HTTP server)
- Docker
- GitHub Actions (CI/CD)
- DockerHub (Image registry)
๐ Project Structure
nodejs-demo-app/
โโโ .github/
โ โโโ workflows/
โ โโโ main.yml # GitHub Actions pipeline
โโโ Dockerfile # Docker build instructions
โโโ .dockerignore # Docker ignore rules
โโโ app.js # Main Node.js app
โโโ package.json # Project metadata & scripts
โโโ README.md # You’re here!
๐ฆ CI/CD Pipeline Overview
๐ Trigger
- Runs on every push to the
mainbranch
๐ง Pipeline Steps
- Checkout code from GitHub
- Set up Node.js environment
- Run
npm installandnpm test - Log in to DockerHub
- Build Docker image
- Push image to DockerHub repository
๐ GitHub Secrets Required
DOCKERHUB_USERNAME: Your DockerHub usernameDOCKERHUB_TOKEN: Your DockerHub access token (not your password)
๐งช Run the App Locally
Make sure Docker is installed and running on your system.
๐ฝ Pull from DockerHub docker pull /nodejs-demo-app
โถ๏ธ Run the container docker run -d -p 3000:3000 /nodejs-demo-app Visit: http://localhost:3000 Youโll see: Hello from Node.js App via GitHub Actions CI/CD
๐ฆ Docker Image Link ๐ DockerHub: jaspreet237/nodejs-demo-app
๐ What I Learned Created a simple Node.js app with HTTP server
Dockerized the application
Set up a full CI/CD pipeline with GitHub Actions
Automated Docker builds and deployment to DockerHub
๐ GitHub Repository ๐ GitHub: jaspreet237/nodejs-demo-app
