Skip to content

Commit

Permalink
project setup
Browse files Browse the repository at this point in the history
  • Loading branch information
nahidkishore committed Sep 9, 2023
1 parent 516b644 commit d54bf85
Show file tree
Hide file tree
Showing 11 changed files with 759 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM maven as build
WORKDIR /app
COPY . .
RUN mvn install


FROM openjdk:11.0
WORKDIR /app
COPY --from=build /app/target/Uber.jar /app/
EXPOSE 9090
CMD [ "java" , "-jar" , "Uber.jar" ]
112 changes: 112 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
pipeline {

agent any

stages{

stage('Git chceckout'){

steps{
git branch: 'main', url: 'https://github.com/PoudelAmrit123/ci-cd-pipeline.git'
}
}
stage('Unit Test'){
steps{
sh 'mvn test'
}
}

stage('Integrated testing'){

steps{
sh 'mvn verify -DskipUnitTests'
}
}

stage('Maven Build'){

steps{
sh 'mvn clean install'
}
}

stage('Static Code Analysis'){

steps{
script{
withSonarQubeEnv(credentialsId: 'sonar-api') {
sh 'mvn clean package sonar:sonar'
}
}
}
}

// stage('Quality Gate status'){
// steps{

// script{
// waitForQualityGate abortPipeline: false, credentialsId: 'sonar-api'
// }
// }


// }

stage('Upload jar File To nexus'){

steps{
script{

def readPomVersion = readMavenPom file: 'pom.xml'

nexusArtifactUploader artifacts:
[[artifactId: 'springboot', classifier: '', file: 'target/Uber.jar', type: 'jar']],
credentialsId: 'nexus-auth',
groupId: 'com.example',
nexusUrl: '65.2.6.64:8081',
nexusVersion: 'nexus3',
protocol: 'http',
repository: 'demoapp-release',
version: "${readPomVersion.version}"
}

}

}

stage('Build Docker File'){

steps{

script{

sh 'docker image build -t $JOB_NAME:v1.$BUILD_ID .'
sh 'docker image tag $JOB_NAME:v1.$BUILD_ID amritpoudel/$JOB_NAME:v1.$BUILD_ID'
sh 'docker image tag $JOB_NAME:v1.$BUILD_ID amritpoudel/$JOB_NAME:latest'
}
}

}

stage('Push To Docker hub'){

steps{

script{
withCredentials([string(credentialsId: 'docker-cred', variable: 'docker_hub_cred')]) {
sh 'docker login -u amritpoudel -p ${docker_hub_cred}'
sh 'docker image push amritpoudel/$JOB_NAME:v1.$BUILD_ID '
sh 'docker image push amritpoudel/$JOB_NAME:latest '
// some block
}

}
}

}


}


}
Binary file modified README.md
Binary file not shown.
23 changes: 23 additions & 0 deletions argocd/Deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: mynodejs-app
spec:
replicas: 2
selector:
matchLabels:
app: mynodejs-app
template:
metadata:
labels:
app: mynodejs-app
spec:
containers:
- name: mynodejs-app
image: amritpoudel/demo-app:latest
resources:
limits:
memory: "128Mi"
cpu: "500m"
ports:
- containerPort: 8080
Loading

0 comments on commit d54bf85

Please sign in to comment.