From abfdf6374bca9fd9ec3721935a660142ad526f5b Mon Sep 17 00:00:00 2001 From: wbrymo <111048430+wbrymo@users.noreply.github.com> Date: Fri, 9 May 2025 23:23:58 +0100 Subject: [PATCH 01/12] Create Jenkins --- Jenkins | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Jenkins diff --git a/Jenkins b/Jenkins new file mode 100644 index 0000000..034be61 --- /dev/null +++ b/Jenkins @@ -0,0 +1,50 @@ +pipeline { + agent any + + environment { + IMAGE_NAME = 'wbrymo/java-calculator' + } + + stages { + stage('Clone Repo') { + steps { + sh ''' + echo "🧹 Cleaning up existing folder if any..." + ls -la || true + rm -rf JavaCalculator || echo "Nothing to delete" + echo "✅ After cleanup:" + ls -la + echo "📥 Cloning repository..." + git clone https://github.com/wbrymo/JavaCalculator.git + ''' + } + } + + stage('Build Docker Image') { + steps { + dir('JavaCalculator') { + script { + def app = docker.build("${IMAGE_NAME}") + } + } + } + } + + stage('Push to Docker Hub') { + steps { + script { + docker.withRegistry('https://index.docker.io/v1/', 'dockerhub-creds') { + docker.image("${IMAGE_NAME}").push('latest') + } + } + } + } + } + + post { + always { + echo "🧼 Cleaning up Jenkins workspace..." + cleanWs() + } + } +} From cd9f22720f56af0ce021c8bdadfd265b90545372 Mon Sep 17 00:00:00 2001 From: wbrymo <111048430+wbrymo@users.noreply.github.com> Date: Sat, 10 May 2025 00:10:03 +0100 Subject: [PATCH 02/12] Delete Jenkins --- Jenkins | 50 -------------------------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 Jenkins diff --git a/Jenkins b/Jenkins deleted file mode 100644 index 034be61..0000000 --- a/Jenkins +++ /dev/null @@ -1,50 +0,0 @@ -pipeline { - agent any - - environment { - IMAGE_NAME = 'wbrymo/java-calculator' - } - - stages { - stage('Clone Repo') { - steps { - sh ''' - echo "🧹 Cleaning up existing folder if any..." - ls -la || true - rm -rf JavaCalculator || echo "Nothing to delete" - echo "✅ After cleanup:" - ls -la - echo "📥 Cloning repository..." - git clone https://github.com/wbrymo/JavaCalculator.git - ''' - } - } - - stage('Build Docker Image') { - steps { - dir('JavaCalculator') { - script { - def app = docker.build("${IMAGE_NAME}") - } - } - } - } - - stage('Push to Docker Hub') { - steps { - script { - docker.withRegistry('https://index.docker.io/v1/', 'dockerhub-creds') { - docker.image("${IMAGE_NAME}").push('latest') - } - } - } - } - } - - post { - always { - echo "🧼 Cleaning up Jenkins workspace..." - cleanWs() - } - } -} From b2790cab7e91a69529997801a0ff40041e6388a6 Mon Sep 17 00:00:00 2001 From: wbrymo <111048430+wbrymo@users.noreply.github.com> Date: Sat, 10 May 2025 12:53:16 +0100 Subject: [PATCH 03/12] Create Jenkins --- Jenkins | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Jenkins diff --git a/Jenkins b/Jenkins new file mode 100644 index 0000000..53b3416 --- /dev/null +++ b/Jenkins @@ -0,0 +1,45 @@ +pipeline { + agent any + + environment { + IMAGE_NAME = 'wbrymo/webapp-calculator' + } + + stages { + stage('Clone Repo') { + steps { + sh ''' + echo "🧹 Cleaning up existing folder if any..." + rm -rf WebAppCal || echo "Nothing to delete" + git clone https://github.com/wbrymo/JavaCalculator.git WebAppCal + ''' + } + } + + stage('Build Docker Image') { + steps { + dir('WebAppCal') { + script { + def app = docker.build("${IMAGE_NAME}") + } + } + } + } + + stage('Push to Docker Hub') { + steps { + script { + docker.withRegistry('https://index.docker.io/v1/', 'dockerhub-creds') { + docker.image("${IMAGE_NAME}").push('latest') + } + } + } + } + } + + post { + always { + cleanWs() + } + } +} From 1ceaac47240045d1263dfa047658c84f184bf5f9 Mon Sep 17 00:00:00 2001 From: wbrymo <111048430+wbrymo@users.noreply.github.com> Date: Sat, 10 May 2025 12:56:33 +0100 Subject: [PATCH 04/12] Update pom.xml --- pom.xml | 94 +++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 65 insertions(+), 29 deletions(-) diff --git a/pom.xml b/pom.xml index 9e1759e..2646345 100644 --- a/pom.xml +++ b/pom.xml @@ -1,30 +1,66 @@ - - 4.0.0 - com.web.cal - WebAppCal - war - 0.0.6 - WebAppCal Maven Webapp - http://maven.apache.org - - - junit - junit - 4.8.2 - test - - - - javax.servlet - servlet-api - 2.5 - - - - - releases - http://52.204.135.48:8081/nexus/content/repositories/releases - - + + + 4.0.0 + com.web.cal + WebAppCal + war + 0.0.6 + WebAppCal Maven Webapp + http://maven.apache.org + + + + junit + junit + 4.8.2 + test + + + + javax.servlet + servlet-api + 2.5 + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + + + + + + org.apache.maven.plugins + maven-war-plugin + 3.3.2 + + + + + + + + releases + http://52.204.135.48:8081/nexus/content/repositories/releases + + + + + + + + + + + From 876e853e46366f33ae764c12e7e3ae132a68e740 Mon Sep 17 00:00:00 2001 From: wbrymo <111048430+wbrymo@users.noreply.github.com> Date: Sat, 10 May 2025 14:18:20 +0100 Subject: [PATCH 05/12] Update Jenkins --- Jenkins | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Jenkins b/Jenkins index 53b3416..c9c927d 100644 --- a/Jenkins +++ b/Jenkins @@ -2,7 +2,7 @@ pipeline { agent any environment { - IMAGE_NAME = 'wbrymo/webapp-calculator' + IMAGE_NAME = 'wbrymo/java-webappcal' } stages { @@ -10,15 +10,16 @@ pipeline { steps { sh ''' echo "🧹 Cleaning up existing folder if any..." - rm -rf WebAppCal || echo "Nothing to delete" - git clone https://github.com/wbrymo/JavaCalculator.git WebAppCal + rm -rf JavaWeb3 || echo "Nothing to delete" + echo "📥 Cloning repository..." + git clone https://github.com/wbrymo/JavaWeb3.git JavaWeb3 ''' } } stage('Build Docker Image') { steps { - dir('WebAppCal') { + dir('JavaWeb3') { script { def app = docker.build("${IMAGE_NAME}") } @@ -39,6 +40,7 @@ pipeline { post { always { + echo "🧼 Cleaning up Jenkins workspace..." cleanWs() } } From 4e94e833eaa9046f5c5890091ad9e995b5376605 Mon Sep 17 00:00:00 2001 From: wbrymo <111048430+wbrymo@users.noreply.github.com> Date: Sat, 10 May 2025 14:33:17 +0100 Subject: [PATCH 06/12] Create Jenkinsfile --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1 @@ + From acad2dc0f588b2d4f1dd773b99eee3a3b668f75e Mon Sep 17 00:00:00 2001 From: wbrymo <111048430+wbrymo@users.noreply.github.com> Date: Sat, 10 May 2025 14:33:45 +0100 Subject: [PATCH 07/12] Update Jenkinsfile --- Jenkinsfile | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 8b13789..c9c927d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1 +1,47 @@ +pipeline { + agent any + environment { + IMAGE_NAME = 'wbrymo/java-webappcal' + } + + stages { + stage('Clone Repo') { + steps { + sh ''' + echo "🧹 Cleaning up existing folder if any..." + rm -rf JavaWeb3 || echo "Nothing to delete" + echo "📥 Cloning repository..." + git clone https://github.com/wbrymo/JavaWeb3.git JavaWeb3 + ''' + } + } + + stage('Build Docker Image') { + steps { + dir('JavaWeb3') { + script { + def app = docker.build("${IMAGE_NAME}") + } + } + } + } + + stage('Push to Docker Hub') { + steps { + script { + docker.withRegistry('https://index.docker.io/v1/', 'dockerhub-creds') { + docker.image("${IMAGE_NAME}").push('latest') + } + } + } + } + } + + post { + always { + echo "🧼 Cleaning up Jenkins workspace..." + cleanWs() + } + } +} From 36047d12bbf8405c983fc0eb05125f5f44bd20b4 Mon Sep 17 00:00:00 2001 From: wbrymo <111048430+wbrymo@users.noreply.github.com> Date: Sat, 10 May 2025 14:34:59 +0100 Subject: [PATCH 08/12] Delete Jenkins --- Jenkins | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 Jenkins diff --git a/Jenkins b/Jenkins deleted file mode 100644 index c9c927d..0000000 --- a/Jenkins +++ /dev/null @@ -1,47 +0,0 @@ -pipeline { - agent any - - environment { - IMAGE_NAME = 'wbrymo/java-webappcal' - } - - stages { - stage('Clone Repo') { - steps { - sh ''' - echo "🧹 Cleaning up existing folder if any..." - rm -rf JavaWeb3 || echo "Nothing to delete" - echo "📥 Cloning repository..." - git clone https://github.com/wbrymo/JavaWeb3.git JavaWeb3 - ''' - } - } - - stage('Build Docker Image') { - steps { - dir('JavaWeb3') { - script { - def app = docker.build("${IMAGE_NAME}") - } - } - } - } - - stage('Push to Docker Hub') { - steps { - script { - docker.withRegistry('https://index.docker.io/v1/', 'dockerhub-creds') { - docker.image("${IMAGE_NAME}").push('latest') - } - } - } - } - } - - post { - always { - echo "🧼 Cleaning up Jenkins workspace..." - cleanWs() - } - } -} From c8c6754f36f34c7725bda607efa7036380bbe2bf Mon Sep 17 00:00:00 2001 From: wbrymo <111048430+wbrymo@users.noreply.github.com> Date: Sat, 10 May 2025 19:35:24 +0100 Subject: [PATCH 09/12] Create Dockerfile --- Dockerfile | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b8c3ff7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +# Stage 1: Build WAR using Maven +FROM maven:3.8.4-openjdk-11 AS builder +WORKDIR /app +COPY . . +RUN mvn dependency:go-offline +RUN mvn -B clean package -DskipTests + +# Stage 2: Deploy WAR on Tomcat +FROM tomcat:9.0 +COPY --from=builder /app/target/WebAppCal-0.0.6.war /usr/local/tomcat/webapps/ROOT.war +EXPOSE 8080 +CMD ["catalina.sh", "run"] From 1ae0901dee34feb5754b4cbe494ec8722de6e8a4 Mon Sep 17 00:00:00 2001 From: wbrymo <111048430+wbrymo@users.noreply.github.com> Date: Thu, 22 May 2025 09:09:14 +0100 Subject: [PATCH 10/12] Delete src directory --- src/main/java/mypackage/Calculator.java | 56 --------------------- src/main/webapp/WEB-INF/web.xml | 15 ------ src/main/webapp/index.jsp | 33 ------------ src/test/java/mypackage/CalculatorTest.java | 26 ---------- 4 files changed, 130 deletions(-) delete mode 100644 src/main/java/mypackage/Calculator.java delete mode 100644 src/main/webapp/WEB-INF/web.xml delete mode 100644 src/main/webapp/index.jsp delete mode 100644 src/test/java/mypackage/CalculatorTest.java diff --git a/src/main/java/mypackage/Calculator.java b/src/main/java/mypackage/Calculator.java deleted file mode 100644 index d49b7ac..0000000 --- a/src/main/java/mypackage/Calculator.java +++ /dev/null @@ -1,56 +0,0 @@ -package mypackage; - -import java.io.*; -import javax.servlet.*; -import javax.servlet.http.*; - -public class Calculator extends HttpServlet -{ - public long addFucn(long first, long second){ - - return first+second; - } - - public long subFucn(long first, long second){ - - return second-first; - } - - public long mulFucn(long first, long second){ - - return first*second; - } - - - public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - { - try - { - response.setContentType("text/html"); - PrintWriter out= response.getWriter(); - int a1= Integer.parseInt(request.getParameter("n1")); - int a2= Integer.parseInt(request.getParameter("n2")); - - - - if(request.getParameter("r1")!=null) - { - out.println("

Addition

"+addFucn(a1, a2)); - } - if(request.getParameter("r2")!=null) - { - out.println("

Substraction

"+subFucn(a1, a2)); - } - if(request.getParameter("r3")!=null) - { - out.println("

Multiplication

"+mulFucn(a1, a2)); - } - RequestDispatcher rd=request.getRequestDispatcher("/index.jsp"); - rd.include(request, response); - } - catch(Exception e) - { - - } - } -} diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 5d7dc19..0000000 --- a/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - Servlet - - Servlet - mypackage.Calculator - - - Servlet - /firstHomePage - - - index.jsp - - \ No newline at end of file diff --git a/src/main/webapp/index.jsp b/src/main/webapp/index.jsp deleted file mode 100644 index 2001178..0000000 --- a/src/main/webapp/index.jsp +++ /dev/null @@ -1,33 +0,0 @@ - - - - -Calculator - - -

Calculator

-
- - -
- - -
-
- - - -
- -
- - diff --git a/src/test/java/mypackage/CalculatorTest.java b/src/test/java/mypackage/CalculatorTest.java deleted file mode 100644 index c27ff5f..0000000 --- a/src/test/java/mypackage/CalculatorTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package mypackage; - -import org.junit.Test; -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; - -public class CalculatorTest { - @Test - public void twoAndThreeIsFive() throws Exception { - final long result = new Calculator().addFucn(2, 3); - assertThat(result, is(5L)); - } - - @Test - public void threeMinusTwoIsOne() throws Exception { - final long result = new Calculator().subFucn(2, 3); - assertThat(result, is(1L)); - } - - @Test - public void threeXThreeIsNine() throws Exception { - final long result = new Calculator().mulFucn(3, 3); - assertThat(result, is(9L)); - } - -} From 92af32a91cf6c92f0e292478cf27b10aef9c7b10 Mon Sep 17 00:00:00 2001 From: wbrymo <111048430+wbrymo@users.noreply.github.com> Date: Thu, 22 May 2025 09:09:29 +0100 Subject: [PATCH 11/12] Delete pom.xml --- pom.xml | 66 --------------------------------------------------------- 1 file changed, 66 deletions(-) delete mode 100644 pom.xml diff --git a/pom.xml b/pom.xml deleted file mode 100644 index 2646345..0000000 --- a/pom.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - 4.0.0 - com.web.cal - WebAppCal - war - 0.0.6 - WebAppCal Maven Webapp - http://maven.apache.org - - - - junit - junit - 4.8.2 - test - - - - javax.servlet - servlet-api - 2.5 - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.8.1 - - 1.8 - 1.8 - - - - - - org.apache.maven.plugins - maven-war-plugin - 3.3.2 - - - - - - - - releases - http://52.204.135.48:8081/nexus/content/repositories/releases - - - - - - - - - - - - From 7673657d67d3b89c8bbdfc58e5ffb549d0da5ecf Mon Sep 17 00:00:00 2001 From: wbrymo <111048430+wbrymo@users.noreply.github.com> Date: Thu, 22 May 2025 09:15:09 +0100 Subject: [PATCH 12/12] Add files via upload --- backend/AppController.java | 14 ++++++++++++++ backend/Main.java | 8 ++++++++ backend/pom.xml | 7 +++++++ 3 files changed, 29 insertions(+) create mode 100644 backend/AppController.java create mode 100644 backend/Main.java create mode 100644 backend/pom.xml diff --git a/backend/AppController.java b/backend/AppController.java new file mode 100644 index 0000000..44f5519 --- /dev/null +++ b/backend/AppController.java @@ -0,0 +1,14 @@ + +package com.cyat.ecommerce; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class AppController { + @GetMapping("/") + public String home() { + return "" + + "

Welcome to CEEYIT E-Commerce Backend

This is a sample API running on Spring Boot.

"; + } +} diff --git a/backend/Main.java b/backend/Main.java new file mode 100644 index 0000000..d364909 --- /dev/null +++ b/backend/Main.java @@ -0,0 +1,8 @@ + +package com.cyat.ecommerce; + +public class Main { + public static void main(String[] args) { + System.out.println("E-commerce Backend Running..."); + } +} diff --git a/backend/pom.xml b/backend/pom.xml new file mode 100644 index 0000000..54bec39 --- /dev/null +++ b/backend/pom.xml @@ -0,0 +1,7 @@ + + + 4.0.0 + com.cyat + ecommerce + 1.0-SNAPSHOT +