diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..b9d7a58
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,11 @@
+FROM tomcat:9.0
+
+# remove default apps
+RUN rm -rf /usr/local/tomcat/webapps/*
+
+# copy WAR
+COPY target/LoginWebApp.war /usr/local/tomcat/webapps/ROOT.war
+
+EXPOSE 8080
+
+CMD ["catalina.sh","run"]
diff --git a/Jenkinsfile b/Jenkinsfile
index 3ce897f..e2f6965 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,47 +1,66 @@
-
pipeline {
-agent {
-label {
- label "built-in"
- customWorkspace "/data/project-myapp"
-
- }
- }
-
- stages {
-
- stage ('CLEAN_OLD_M2') {
-
- steps {
- sh "rm -rf /home/saccount/.m2/repository"
-
- }
-
- }
-
- stage ('MAVEN_BUILD') {
-
- steps {
-
- sh "mvn clean package"
-
- }
-
-
- }
-
- stage ('COPY_WAR_TO_Server'){
-
- steps {
-
- sh "scp -r target/LoginWebApp.war saccount@10.0.2.51:/data/project/wars"
+ agent none
+
+ environment {
+ MAVEN_HOME = "/mnt/build-tools/apache-maven-3.9.10"
+ PATH = "${env.MAVEN_HOME}/bin:${env.PATH}"
+ }
+
+ stages {
+
+ stage('Clone Git Repository') {
+ agent { label 'built-in' } // Master node
+ steps {
+ dir('/mnt') {
+ git url: 'https://github.com/Chetashree20/project.git'
+ }
+ }
+ }
+
+ stage('Build WAR on Master') {
+ agent { label 'built-in' }
+ steps {
+ dir('/mnt/project') {
+ sh 'rm -rf ~/.m2/repository'
+ sh 'mvn clean package'
+ stash name: 'warfile', includes: 'target/LoginWebApp.war'
+ }
+ }
+ }
+
+ stage('Deploy on Slave') {
+ agent { label 'slave1' }
+ steps {
+ dir('/mnt/projects') {
+ deleteDir()
+ unstash 'warfile'
+
+ // Place WAR in Tomcat
+ sh '''
+ cp target/LoginWebApp.war /mnt/servers/apache-tomcat-9.0.106/webapps/
+ '''
+ }
+ }
+ }
+
+ stage('Update JSP for RDS') {
+ agent { label 'slave1' }
+ steps {
+ sh '''
+ sleep 10
+ sed -i 's|jdbc:mysql://localhost:3306/test", "root", "root"|jdbc:mysql://database-1.cb48gkq0ufgf.ap-south-1.rds.amazonaws.com:3306/test", "admin", "admin123456"|g' /mnt/servers/apache-tomcat-9.0.106/webapps/LoginWebApp/userRegistration.jsp
+ '''
+ }
+ }
- }
-
- }
-
-
-
- }
-
+ stage('Start Tomcat on Slave') {
+ agent { label 'slave1' }
+ steps {
+ sh '''
+ /mnt/servers/apache-tomcat-9.0.106/bin/shutdown.sh || true
+ /mnt/servers/apache-tomcat-9.0.106/bin/startup.sh
+ '''
+ }
+ }
+ }
}
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..09782de
--- /dev/null
+++ b/README.md
@@ -0,0 +1,4 @@
+# Login Application
+
+This project follows GitHub Flow.
+All changes are made via feature branches and Pull Requests.
diff --git a/src/main/webapp/success.jsp b/src/main/webapp/success.jsp
index bbc3eca..f556828 100644
--- a/src/main/webapp/success.jsp
+++ b/src/main/webapp/success.jsp
@@ -4,9 +4,12 @@
You are not logged in
Please Login
<%} else {
+%>
+You are Successfully logged in
+
%>
Welcome <%=session.getAttribute("userid")%>
Log out
<%
}
-%>
\ No newline at end of file
+%>