Node.js Demo App with CI/CD using GitHub Actions & DockerHub

By | August 27, 2025

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 main branch

๐Ÿ”ง Pipeline Steps

  1. Checkout code from GitHub
  2. Set up Node.js environment
  3. Run npm install and npm test
  4. Log in to DockerHub
  5. Build Docker image
  6. Push image to DockerHub repository

๐Ÿ” GitHub Secrets Required

  • DOCKERHUB_USERNAME: Your DockerHub username
  • DOCKERHUB_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

Leave a Reply

Your email address will not be published. Required fields are marked *