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"]
diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 0000000..c9c927d
--- /dev/null
+++ b/Jenkinsfile
@@ -0,0 +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()
+ }
+ }
+}
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
+
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index 9e1759e..0000000
--- a/pom.xml
+++ /dev/null
@@ -1,30 +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
-
-
-
-
- releases
- http://52.204.135.48:8081/nexus/content/repositories/releases
-
-
-
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));
- }
-
-}