惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
阮一峰的网络日志
阮一峰的网络日志
J
Java Code Geeks
宝玉的分享
宝玉的分享
C
CXSECURITY Database RSS Feed - CXSecurity.com
P
Privacy International News Feed
The Register - Security
The Register - Security
T
Threat Research - Cisco Blogs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
PCI Perspectives
PCI Perspectives
Hugging Face - Blog
Hugging Face - Blog
T
Tailwind CSS Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
N
News | PayPal Newsroom
Google Online Security Blog
Google Online Security Blog
aimingoo的专栏
aimingoo的专栏
F
Full Disclosure
P
Palo Alto Networks Blog
A
About on SuperTechFans
Microsoft Azure Blog
Microsoft Azure Blog
F
Fortinet All Blogs
爱范儿
爱范儿
Recorded Future
Recorded Future
月光博客
月光博客
T
True Tiger Recordings
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tenable Blog
L
Lohrmann on Cybersecurity
博客园 - 聂微东
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
大猫的无限游戏
大猫的无限游戏
S
Security @ Cisco Blogs
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
L
LINUX DO - 热门话题
Hacker News: Ask HN
Hacker News: Ask HN
C
Check Point Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
L
LangChain Blog
The Cloudflare Blog
Malwarebytes
Malwarebytes
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
I
InfoQ
N
Netflix TechBlog - Medium
Recent Announcements
Recent Announcements
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
SecWiki News
SecWiki News
云风的 BLOG
云风的 BLOG
T
ThreatConnect
博客园 - 叶小钗
B
Blog

DEV Community

Zero-Downtime Blue-Green and IP-Based Canary Deployments on ECS Fargate I reproduced a Claude Code RCE. The bug pattern is everywhere. We Replaced Our RAG Pipeline With Persistent KV Cache. Here's What We Found. How to Stream Live Forex Rates to Google Sheets API: A Complete Guide Small Models Will Beat Giant Models (And Most People Haven’t Realized Why Yet) How I Built 5 Linux Automation Scripts on AWS EC2 I built TokenPatch to measure AI coding cost per applied patch I built a Chrome extension to stop squinting at the web Producer audit clean, six tests red Conversa — A Multi-Agent AI Platform Powered by Gemma 4 Build a Real Agent in 15 Minutes with Gemini's New Managed Agents API What I Actually Build: AI Systems That Ship, Not Demos That Impress The Box Ticked While You Read This: LinkedIn, AI Training, and the Switch You Did Not Flip Investasi Masa Depan: Mengintip Fasilitas Laboratorium Komputer Kelas Dunia di Yogyakarta I Cancelled My $20 Claude Cowork Plan After a Week With OpenWork Stop Reviewing Every Line of AI Code - Build the Trust Stack Instead How To Build an Image Cropper in Browser (Simple Steps) I built a macOS disk cleaner for developers and just launched it would love feedback Membangun Kompetensi dan Relasi: Mengapa Ekosistem Kampus Itu Penting I Built an AI That Decides Which AI to Talk To — Running 24/7 From My Living Room Codex Team Usage SOP How to Actually Become a Programmer: The Hard Part Nobody Wants to Explain Building a Production-Style Multi-Tool AI Agent with Python, Flask, React & Gemini AI The Caretaker Sandbox: An Offline-First Visual Playground & Template Engine powered by Gemma 4 # Building Instagram OSINT Projects with HikerAPI Your AI can read. Gemma 4 can see The Battle of the Senior Dev: Why AI Gives You Wings But Only If You're Ready to Pilot HiDream Raw Output Failed Tried Dev-2604 VRAM Math Killed It Won with a Prompt Enhancer Instead I Finally Finished a Project I Abandoned — And GitHub Copilot Helped Me Ship It SafeSMS: On-Device Threat Detection with Gemma 4 E4B, no internet required I Built OpenKap — A Loom Alternative for Small Teams Who Just Want to Ship Gemma 4 is Here: The Dawn of Local Multimodal Reasoning Offline-First Flutter: How We Built a CRM That Manages 100K+ Leads With No Internet Memory for Agents: When Vectors Meet Graphs, Bugs Drop 4 The Rise of Production-Grade AI Infrastructure I ran my idea-validation product through its own validator. The verdict was PIVOT. We Built an Agent Commerce API. Google I/O 2026 Changed Our 3-Month Roadmap in 24 Hours. "My Partner's Memory Was Full. I Didn't Know — Until We Tried to Talk." I’m a Front End Web Developer Learning Machine Learning From Scratch Laravel Waiting Request I Built a Chrome Extension to Track How Long You Actually Spend on Each Tab Why Google Can't See Your React Breadcrumbs (And the 4-Line Fix) AI Travel Assistant Powered by Gemma 4; With Streaming, Image Input, and Visual Recommendation Cards Microsoft tried to kill the printer driver. Healthcare said no. The Blueprint Beneath the Blueprint: Designing Data Model and Choosing Its Database REST APIs vs Webhooks in Telecom Billing - Which One Actually Makes Sense? Accounting Made Simple: AI-Powered Financial Insights of Japanese Companies with Gemma 4 The append-only AST trick that makes Flutter AI chat actually smooth Designing the Future of Payments — Why XML Still Matters in the Age of APIs From Legacy to Live — Reviving XMLPayments with GitHub Copilot Two Weeks Into Learning Solana XMLPayments — The Hidden Backbone of Modern Financial Orchestration AI Agents in Practice — Read from the beginning Reviving My Gemma Agentic Framework: From Prototype to Polished Repo Smart Contracts Demand Better Infrastructure: Building on contract.dev Self-Hosted LLM Tool Calling: Forge and the Build-vs-Buy Decision ORA-00072 오류 원인과 해결 방법 완벽 가이드 OpenWA for CTOs: Self-Hosted WhatsApp Gateway Trade-Offs NotebookLM Automation With notebooklm-py: Useful, But Classify Data First Docker v29.5.x Operator Upgrade Checklist Coding-Agent Instruction Design: The CLAUDE.md File That Prevents Rework When I Finally Realized My Runtime Was Holding Me Back GnokeOps: Host Your Own AI House Party The Death of Static Rate Limiters: Why Your Java Virtual Threads Need BBR-Style Adaptive Concurrency AI Agents in Practice — Part 2: What Makes Something an Agent Stop scattering LLM SDK/API calls across your codebase. Here is the 2-file rule that fixed mine Beyond Prompts: Structuring AI Workflows for Real Frontend Engineering From an Abandoned Hackathon Project to an AI Study Workspace 🚀 Terraform with AI: Build AWS Infra (Cursor + MCP) What If AI Didn’t Need the Internet? 750,000 Chips, 140 Trillion Tokens: The Math Behind DeepSeek's Permanent Price Cut You're Renting Someone Else's Compute — And It's Costing You More Than You Think CSS :has() Selector: The Layout Trick I Wish I Knew 5 Years Ago Five Clusters. Five Lessons. One Production System. Synaptic: A Local-First AI Dev Companion That Remembers How You Think Revolutionizing Edge MedTech: Building a Sovereign Sleep Apnea Companion ("XiHan Snore Coach") with Gemma 4 HDD Eksternal Tiba-Tiba Tidak Bisa Diakses di Windows? Ini Tiga Lapis Fix-nya DMARC p=none vs p=quarantine vs p=reject: what to use and when DSA Application in Real Life: How Git Diff Works: LCS Intuition, Myers Algorithm, and Real Code Changes I solo-built a reputation layer for AI agents on NEAR — and here's what I learned I built an AI faceless video generator in 2 months — here's the stack Diffusion Language Models: How NVIDIA Nemotron-Labs Diffusion Shatters the Autoregressive Speed Ceiling llm-nano-vm v0.8.0 — deterministic FSM runtime for LLM pipelines, now with output validation and per-step timeouts From the Renaissance to the Quantum Dawn: AI, Computation, and the Next Paradigm Shift How I Built a Review Site with 800+ Articles Using AI I Built a Smart Kitchen AI with Gemma 4 That Turns Fridge Photos Into Recipes Why your vulnerability dashboard is lying to you (and how to fix it) From Abandoned Prototype to Smart AI System: Reviving Trafiq AI with GitHub Copilot Why Country/State/City Pickers Are Weirdly Hard Node.js 22 LTS — EOL Date, Support Timeline, and What Comes Next The 7-Layer Memory Architecture Behind Modern AI Agents I Imagined Hermes Agent Running an Entire Smart City — And It Changed How I See AI One backend, four products: why we bet on platform-per-brand AI's tech debt is invisible — even to AI. I solved it at the architecture layer. Why ROAS 300% Can Still Mean Losses — Gross Margin in 5 Ecommerce Verticals You Don’t Need to Try Every AI Tool to Keep Up NovelPilot: A Novel Writing Agent Powered by Gemma 4 BoxAgnts is an Out-Of-The-Box Secure AI Agent ToolBox in a WASM SandBox Gemma 4 deep dive: why a 1.5 GB model scores 37.5% on competition mathematics, how the MoE routing actually works, and which model fits your hardware. Full breakdown inside. BeeLlama v0.2.0: 164 tok/s on a 27B model, one RTX 3090
Jenkins CI/CD Pipeline for a Dockerized Node.js Application: Manual Trigger vs Automatic Trigger Using GitHub Webhooks
Omkar Sharma · 2026-05-23 · via DEV Community

Have you ever pushed code to GitHub and wished your application could automatically build and deploy itself without logging into a server or clicking a button in Jenkins? In this article, you'll learn how to build a complete CI/CD pipeline for a Dockerized Node.js application using Jenkins, starting with manual deployments and progressing to fully automated deployments using GitHub webhooks.

We will cover:

  • Creating a Jenkins pipeline
  • Building a Docker image
  • Deploying a container
  • Triggering builds manually
  • Triggering builds automatically
  • GitHub Personal Access Tokens
  • Fine-grained vs Classic Tokens
  • Jenkins credentials
  • GitHub webhooks
  • Required Jenkins plugins
  • Common errors and troubleshooting The goal is to understand not only how to configure everything but also why each component is needed.

Node.js Application Repo URL- https://github.com/omkarsharma2821/Node.js-App-Deploy-Github-Action

Architecture Overview

The complete flow looks like this:

Developer
    |
    | Git Push
    v
GitHub Repository
    |
    | Webhook
    v
Jenkins
    |
    | Build Docker Image
    v
Docker
    |
    | Run Container
    v
Application Running

Enter fullscreen mode Exit fullscreen mode

Without webhooks:

Developer
    |
    | Git Push
    v
GitHub Repository

Jenkins Build Now (Manual Trigger)
    |
    v
Build and Deploy

Enter fullscreen mode Exit fullscreen mode

With webhooks:

Developer
    |
    | Git Push
    v
GitHub Repository
    |
    v
Webhook
    |
    v
Jenkins
    |
    v
Build and Deploy Automatically

Enter fullscreen mode Exit fullscreen mode

Prerequisites

Before starting, ensure you have:

  • Ubuntu Server
  • Jenkins installed
  • Docker installed
  • Git installed
  • GitHub repository
  • Node.js application with Dockerfile Verify installations:
jenkins --version
docker --version
git --version

Enter fullscreen mode Exit fullscreen mode

Installing Docker on Jenkins Server

Install Docker:

sudo apt update
sudo apt install docker.io -y

Enter fullscreen mode Exit fullscreen mode

Enable Docker:

sudo systemctl enable docker
sudo systemctl start docker

Enter fullscreen mode Exit fullscreen mode

Verify:

docker --version

Enter fullscreen mode Exit fullscreen mode

Allow Jenkins to Use Docker

By default Jenkins cannot execute Docker commands.

Add Jenkins user to Docker group:

sudo usermod -aG docker jenkins

Enter fullscreen mode Exit fullscreen mode

Restart Jenkins:

sudo systemctl restart jenkins

Enter fullscreen mode Exit fullscreen mode

Verify:

sudo su - jenkins
docker ps

Enter fullscreen mode Exit fullscreen mode

If Docker works without sudo, Jenkins is ready.

Creating the Pipeline

Initially we created a Jenkins pipeline that manually clones the repository.

Example:

pipeline {
    agent any

    stages {

        stage('Clone Repository') {
            steps {
                sh '''
                    mkdir -p devops
                    cd devops
                    rm -rf Node.js-App-Deploy-Github-Action
                    git clone -b main https://github.com/username/repository.git
                '''
            }
        }

        stage('Build Image') {
            steps {
                sh '''
                    cd devops/Node.js-App-Deploy-Github-Action
                    docker build -t node-app .
                '''
            }
        }

        stage('Deploy') {
            steps {
                sh '''
                    docker run -d -p 8000:8080 node-app
                '''
            }
        }
    }
}

Enter fullscreen mode Exit fullscreen mode

This works, but every deployment requires manually clicking:

Build Now

Enter fullscreen mode Exit fullscreen mode

Problem with Multiple Deployments

Suppose the application is already running.

Running:

docker run -d -p 8000:8080 node-app

Enter fullscreen mode Exit fullscreen mode

again will fail because port 8000 is already occupied.

Error:

Bind for 0.0.0.0:8000 failed

Enter fullscreen mode Exit fullscreen mode

Better Deployment Approach

Before starting a new container, remove the old one.

docker rm -f node-app-container || true

Enter fullscreen mode Exit fullscreen mode

Then start a new container:

docker run -d --name node-app-container -p 8000:8080 node-app

Enter fullscreen mode Exit fullscreen mode

Understanding docker rm -f node-app-container || true

Let's break it down.

docker rm

Removes a container.

docker rm node-app-container

Enter fullscreen mode Exit fullscreen mode

Works only if container is stopped.

-f

Force remove.

docker rm -f node-app-container

Enter fullscreen mode Exit fullscreen mode

This:

  1. Stops container
  2. Removes container

||

OR operator.

Syntax:

command1 || command2

Enter fullscreen mode Exit fullscreen mode

If command1 fails, command2 executes.

true

Always returns success.

true

Enter fullscreen mode Exit fullscreen mode

Exit code:

0

Enter fullscreen mode Exit fullscreen mode

Final Meaning

docker rm -f node-app-container || true

Enter fullscreen mode Exit fullscreen mode

If container exists:

Remove it

Enter fullscreen mode Exit fullscreen mode

If container doesn't exist:

Ignore error and continue

Enter fullscreen mode Exit fullscreen mode

This prevents Jenkins from failing.

Manual Triggering

The simplest approach is manual execution.

Navigate to:

Jenkins Job
|
└── Build Now

Enter fullscreen mode Exit fullscreen mode

Advantages:

  • Easy to understand
  • Good for learning
    Disadvantages:

  • Requires human intervention

  • Not real CI/CD

Automatic Triggering

The goal of CI/CD is:

Code Push
    |
    v
Automatic Build
    |
    v
Automatic Deployment

Enter fullscreen mode Exit fullscreen mode

This is where GitHub webhooks come into play.

Required Jenkins Plugins

Install the following Jenkins plugins before configuring the CI/CD pipeline:

1. Git Plugin

  • Enables Jenkins to interact with Git repositories.
  • Allows Jenkins to clone repositories, fetch changes, and checkout specific branches.
  • Required for integrating Jenkins with GitHub repositories.

2. GitHub Plugin

  • Provides integration between Jenkins and GitHub.
  • Allows Jenkins to communicate with GitHub repositories and services.
  • Supports GitHub-related features within Jenkins.

3. GitHub Integration Plugin

  • Enables GitHub webhook support.
  • Allows Jenkins to automatically trigger builds when code is pushed to GitHub.
  • Essential for implementing automated CI/CD workflows.

4. Pipeline Plugin

  • Enables support for Jenkins Pipelines.
  • Allows execution of Jenkinsfiles written in Declarative or Scripted Pipeline syntax.
  • Required for defining CI/CD workflows as code.

5. Credentials Plugin

  • Provides secure storage for sensitive information.
  • Allows storing:
    • GitHub Personal Access Tokens (PATs)
    • Usernames and passwords
    • SSH keys
    • API tokens
  • Prevents hardcoding secrets in Jenkins jobs and pipelines.

GitHub Authentication

When Jenkins needs to access a GitHub repository, authentication requirements depend on the repository type.

Public Repository

  • Can typically be cloned without authentication.

Example:

git clone https://github.com/username/repository.git

Enter fullscreen mode Exit fullscreen mode

Private Repository

  • Requires authentication.
  • GitHub no longer supports account passwords for Git operations.
  • A Personal Access Token (PAT) must be used instead of a password.

Why Use a Personal Access Token (PAT)?

  • More secure than passwords.
  • Allows granular permission control.
  • Can be revoked without affecting your GitHub account password.
  • Recommended by GitHub for all Git operations requiring authentication.

Classic Personal Access Token

Older token type.

Advantages:

  • Simple
  • Easy to configure
    Disadvantages:

  • Broad permissions

  • Less secure
    Example scopes:

repo
workflow
admin:repo_hook

Enter fullscreen mode Exit fullscreen mode

Fine-Grained Personal Access Token

Newer and recommended approach.

Advantages:

  • Repository-level access
  • Better security
  • Granular permissions Example:
Repository Access:
Only selected repositories

Enter fullscreen mode Exit fullscreen mode

Permissions:

Contents: Read and Write
Metadata: Read
Webhooks: Read and Write

Enter fullscreen mode Exit fullscreen mode

Fine-Grained vs Classic Token

Feature Fine-Grained Classic
Security High Lower
Repository Scope Specific Broad
Permission Control Granular Broad
Recommended Yes Legacy

For modern projects, prefer Fine-Grained tokens.

Adding GitHub Token to Jenkins

Navigate to:

Manage Jenkins
|
Credentials

Enter fullscreen mode Exit fullscreen mode

Select:

Global Credentials

Enter fullscreen mode Exit fullscreen mode

Choose:

Add Credentials

Enter fullscreen mode Exit fullscreen mode

Kind:

Username with Password

Enter fullscreen mode Exit fullscreen mode

Example:

Username: GitHub Username
Password: Personal Access Token

Enter fullscreen mode Exit fullscreen mode

ID:

github-creds

Enter fullscreen mode Exit fullscreen mode

Save.

Pipeline Script vs Pipeline Script from SCM

Many beginners get confused here.

Pipeline Script

Pipeline stored inside Jenkins UI.

Example:

pipeline {
    agent any
}

Enter fullscreen mode Exit fullscreen mode

Advantages:

  • Quick setup
    Disadvantages:

  • Not version controlled

  • Difficult to maintain

Pipeline Script from SCM

Pipeline stored in GitHub repository.

Repository structure:

project/
|
|-- Dockerfile
|-- package.json
|-- app.js
|-- Jenkinsfile

Enter fullscreen mode Exit fullscreen mode

Jenkins automatically downloads Jenkinsfile.

Advantages:

  • Version controlled
  • Industry standard
  • Easier maintenance Recommended approach.

Configuring Pipeline from SCM

Create Jenkins job.

Select:

Pipeline

Enter fullscreen mode Exit fullscreen mode

Under Definition:

Pipeline script from SCM

Enter fullscreen mode Exit fullscreen mode

SCM:

Git

Enter fullscreen mode Exit fullscreen mode

Repository URL:

https://github.com/username/repository.git

Enter fullscreen mode Exit fullscreen mode

Branch:

*/main

Enter fullscreen mode Exit fullscreen mode

Script Path:

Jenkinsfile

Enter fullscreen mode Exit fullscreen mode

Save.

Creating GitHub Webhook

Navigate to:

GitHub Repository
|
Settings
|
Webhooks
|
Add Webhook

Enter fullscreen mode Exit fullscreen mode

Payload URL:

http://JENKINS_PUBLIC_IP:8080/github-webhook/

Enter fullscreen mode Exit fullscreen mode

Content Type:

application/json

Enter fullscreen mode Exit fullscreen mode

Event:

Just the push event

Enter fullscreen mode Exit fullscreen mode

Save webhook.

Configuring Jenkins Trigger

Open job configuration.

Under Build Triggers:

Select:

GitHub hook trigger for GITScm polling

Enter fullscreen mode Exit fullscreen mode

Save.

Testing the Webhook

Push code:

git add .
git commit -m "testing webhook"
git push origin main

Enter fullscreen mode Exit fullscreen mode

Expected flow:

GitHub Push
    |
    v
Webhook
    |
    v
Jenkins
    |
    v
Pipeline Starts

Enter fullscreen mode Exit fullscreen mode

No manual click required.


Common Troubleshooting

Webhook Returns 404

Cause:

Wrong webhook URL

Enter fullscreen mode Exit fullscreen mode

Correct:

http://SERVER-IP:8080/github-webhook/

Enter fullscreen mode Exit fullscreen mode

Webhook Returns 403

Cause:

Authentication or security issue

Enter fullscreen mode Exit fullscreen mode

Verify:

  • GitHub plugin
  • GitHub integration plugin

Webhook Returns 200 But Build Doesn't Start

Common cause:

Pipeline Script instead of Pipeline Script from SCM

Enter fullscreen mode Exit fullscreen mode

or

Repository mapping issue

Enter fullscreen mode Exit fullscreen mode

Dockerfile Not Found

Example:

unable to evaluate symlinks in Dockerfile path

Enter fullscreen mode Exit fullscreen mode

Cause:

Wrong working directory.

Check:

pwd
ls -la

Enter fullscreen mode Exit fullscreen mode

Verify Dockerfile location.

Permission Denied While Running Docker

Cause:

Jenkins not in docker group

Enter fullscreen mode Exit fullscreen mode

Fix:

sudo usermod -aG docker jenkins
sudo systemctl restart jenkins

Enter fullscreen mode Exit fullscreen mode

Final Jenkinsfile

pipeline {
    agent any

    stages {

        stage('Build Image') {
            steps {
                sh '''
                    docker build -t node-app .
                '''
            }
        }

        stage('Deploy') {
            steps {
                sh '''
                    docker rm -f node-app-container || true
                    docker run -d --name node-app-container -p 8000:8080 node-app
                '''
            }
        }
    }
}

Enter fullscreen mode Exit fullscreen mode

Conclusion

A Jenkins pipeline can be triggered manually or automatically. Manual triggering is useful for learning and testing, but real CI/CD begins when code pushes automatically trigger builds and deployments.

The recommended production approach is:

  1. Store the Jenkinsfile in GitHub.
  2. Use Pipeline Script from SCM.
  3. Configure GitHub credentials using a Personal Access Token.
  4. Enable GitHub webhook integration.
  5. Use Docker for packaging and deployment.
  6. Remove old containers before deploying new versions. With this setup, every code push automatically builds a Docker image, deploys a fresh container, and updates the application without requiring any manual intervention.

✍️ Author: Omkar Sharma

📬 Feel free to connect on LinkedIn or explore more on GitHub