From 2cec404176348ef6cbdabb495398fa79f7edac3b Mon Sep 17 00:00:00 2001 From: jaygohel164 Date: Fri, 20 Feb 2026 11:47:41 +0530 Subject: [PATCH 1/4] chore: Update Node.js version and application port - Downgrade Node.js base image from 24-alpine to 22-alpine in Dockerfile - Change application port from 3000 to 8000 in app.js - Update docker-compose.yml port mapping from 3000:3000 to 8000:8000 - Ensure consistency across Docker configuration and application settings --- Dockerfile | 4 ++-- app.js | 2 +- docker-compose.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 511d3651..6a309c40 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:24-alpine +FROM node:22-alpine # Create app user and group RUN addgroup app && adduser -S -G app app @@ -15,5 +15,5 @@ COPY . . # Switch to non-root user for runtime USER app -EXPOSE 3000 +EXPOSE 8000 CMD ["node", "app.js"] diff --git a/app.js b/app.js index 007d9367..226d3422 100644 --- a/app.js +++ b/app.js @@ -4,7 +4,7 @@ const express = require('express'); const app = express(); -app.set('port', process.env.PORT || 3000); // Application port is set +app.set('port', process.env.PORT || 8000); // Application port is set app.set('views', __dirname + '/app/server/views'); // Views folder is set app.set('view engine', 'ejs'); // View engine is set app.use(express.static(__dirname + '/app/public')); // Public folder containing static files is set diff --git a/docker-compose.yml b/docker-compose.yml index 40c0bbf0..beb012dd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,4 +5,4 @@ services: context: . dockerfile: Dockerfile ports: - - "3000:3000" \ No newline at end of file + - "8000:8000" \ No newline at end of file From c7c26615b453815ad6a36604ac3a5455839ba891 Mon Sep 17 00:00:00 2001 From: jaygohel164 Date: Fri, 20 Feb 2026 12:25:19 +0530 Subject: [PATCH 2/4] docs: Update application title and branding in index view - Update page title to include author attribution "by Jay" - Update body text to display full author name "by Jay Gohel" - Personalize the sample application with creator information --- app/server/views/index.ejs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/server/views/index.ejs b/app/server/views/index.ejs index fe2d4951..21bb15f5 100644 --- a/app/server/views/index.ejs +++ b/app/server/views/index.ejs @@ -1,9 +1,9 @@ - Sample Node.js Application + Sample Node.js Application by Jay - Sample Node.js Application + Sample Node.js Application by Jay Gohel \ No newline at end of file From 2b37f86aa91c6f82d102319c5ffe6573aff5fb80 Mon Sep 17 00:00:00 2001 From: jaygohel164 Date: Mon, 23 Feb 2026 12:59:59 +0530 Subject: [PATCH 3/4] docs: Update application title for consistency in index view --- app/server/views/index.ejs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/server/views/index.ejs b/app/server/views/index.ejs index 21bb15f5..ad95a94f 100644 --- a/app/server/views/index.ejs +++ b/app/server/views/index.ejs @@ -1,7 +1,7 @@ - Sample Node.js Application by Jay + Sample Node.js Application by Jay Gohel Sample Node.js Application by Jay Gohel From adee5fc56d15fe9e545044d74191544f3e2de4dc Mon Sep 17 00:00:00 2001 From: jaygohel164 Date: Mon, 23 Feb 2026 13:07:49 +0530 Subject: [PATCH 4/4] ci: Add Jenkins pipeline for Docker container deployment --- Jenkins | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 Jenkins diff --git a/Jenkins b/Jenkins new file mode 100644 index 00000000..7d028253 --- /dev/null +++ b/Jenkins @@ -0,0 +1,58 @@ +pipeline { + agent any + + environment { + IMAGE_NAME = "sample-node-app" + CONTAINER_NAME = "node-app-container" + PORT = "8000" + } + + stages { + + stage('Clone Repository') { + steps { + git branch: 'dev', + url: 'https://github.com/Jaygohel164/sample-node-project.git' + } + } + + stage('Build Docker Image') { + steps { + sh "docker build -t ${IMAGE_NAME}:latest ." + } + } + + stage('Stop Old Container') { + steps { + sh "docker stop ${CONTAINER_NAME} || true" + sh "docker rm ${CONTAINER_NAME} || true" + } + } + + stage('Run Docker Container') { + steps { + sh """ + docker run -d \ + --name ${CONTAINER_NAME} \ + -p ${PORT}:${PORT} \ + ${IMAGE_NAME}:latest + """ + } + } + + stage('Verify') { + steps { + sh "docker ps | grep ${CONTAINER_NAME}" + } + } + } + + post { + success { + echo "App running at http://3.109.202.16:8000" + } + failure { + sh "docker logs ${CONTAINER_NAME} || true" + } + } +} \ No newline at end of file