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

Dockerpackage #145

Open
wants to merge 17 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
73 changes: 73 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
pipeline {
agent none
stages {
stage('build') {
agent {
docker {
image 'maven:3.6.3-jdk-11-slim'
}

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

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

}
steps {
echo 'test'
sh 'mvn clean test'
}
}
stage('Parallel Stage') {
when {
branch 'master'
}
failFast true
parallel {
stage('package') {
agent {
docker {
image 'maven:3.6.3-jdk-11-slim'
}

}
steps {
echo 'package'
sh 'mvn package -DskipTests'
}
}

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

}
}
}}
}
tools {
maven 'Maven 3.6.3'
}
post {
always {
echo 'This pipeline is completed..'
}

}
}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
This is a Sample Maven App.
trigger build
trigger2
t3
1 change: 1 addition & 0 deletions test
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test rules