Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rjoshi1906 patch 1 #174

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM maven:3.6.3-jdk-11-slim as build
WORKDIR /opt/demo
COPY . /opt/demo
RUN mvn package -DskipTests

FROM tomcat:jre8-openjdk-slim-buster as run
WORKDIR /usr/local/tomcat
COPY --from=build /opt/demo/target/sysfoo.war webapps/ROOT.war
90 changes: 90 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
pipeline {
agent none
stages {
stage('build') {
agent {
docker {
image 'maven:3.6.3-jdk-11-slim'
}

}
steps {
echo 'compile maven app'
sh 'mvn compile'
}
}

stage('test') {
agent {
docker {
image 'maven:3.6.3-jdk-11-slim'
}

}
steps {
echo 'test maven app'
sh 'mvn clean test'
}
}

stage('package') {
parallel {
stage('package') {
agent {
docker {
image 'maven:3.6.3-jdk-11-slim'
}

}
when {
branch 'master'
}
steps {
echo 'package maven app'
sh 'mvn package -DskipTests'
archiveArtifacts 'target/*.war'
}
}

stage('Docker BnP') {
agent any
when {
branch 'master'
}
steps {
script {
docker.withRegistry('https://index.docker.io/v1/', 'dockerlogin') {
def dockerImage = docker.build("rjoshiadb/sysfoo:v${env.BUILD_ID}", "./")
dockerImage.push()
dockerImage.push("latest")
dockerImage.push("dev")
}
}

}
}

}
}

stage('Deploy to Dev') {
agent any
when {
branch 'master'
}
steps {
sh 'docker-compose up -d'
}
}

stage('Sleep') {
steps {
sleep 2
}
}

}
tools {
maven 'Maven 3.6.3'
}
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
This is a Sample Maven App.
Last edited by [email protected]
7 changes: 7 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: "3.8"

services:
sysfoo:
image: rjoshiadb/sysfoo:dev
ports:
- 8888:8080
2 changes: 1 addition & 1 deletion src/main/webapp/index.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</div>
<div class="content">
<div class="inner">
<h1>version 0.0.2 </h1>
<h1>version 1.0.0 </h1>
<h2>SYSTEM INFO</h2>
<a class="button special"><% out.println(request.getLocalAddr()); %></a>
<p>
Expand Down
2 changes: 2 additions & 0 deletions test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
New line
:wq!