Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM ubuntu:22.04

MAINTAINER its an optional instructions

RUN apt update -y && apt install openjdk-8-jdk wget -y

RUN wget https://dlcdn.apache.org/tomcat/tomcat-8/v8.5.98/bin/apache-tomcat-8.5.98.tar.gz

RUN tar -xzf apache-tomcat-8.5.98.tar.gz

EXPOSE 8080

WORKDIR /apache-tomcat-8.5.98/

#COPY vprofile-v1.war /apache-tomcat-8.5.98/webapps/

ENTRYPOINT ["/apache-tomcat-8.5.98/bin/catalina.sh", "run"]

60 changes: 60 additions & 0 deletions Jenkinsfile-2
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
pipeline {
environment {
registry = "komal921/docker-test"
registryCredential = 'docc-credentials'
dockerImage = ''
}
agent any
tools {
jdk "java-8"
maven "maven-3"
}
stages {
stage('Cloning Git') {
steps {
git branch: 'develop', changelog: false, poll: false, url: 'https://github.com/komalkhiratkar/VProfile.git'
}
}

stage ('Build maven') {
steps {
sh 'mvn package'
}
}

stage('Building image') {
steps{
script {
dockerImage = docker.build registry + ":$BUILD_NUMBER"
}
}
}

stage('Deploy Image') {
steps{
script {
docker.withRegistry( '', registryCredential ) {
dockerImage.push()
}
}
}
}
stage('Remove Unused docker image') {
steps{
sh "docker rmi $registry:$BUILD_NUMBER"
}
}
stage ('pull and run docker latest image') {
steps{
script {
withDockerRegistry(credentialsId: 'docc-credentials') {
sh "docker build -t komal921/docker-test ."
sh "docker run -itd komal921/docker-test"
}
}
}
}
}
}