Add Dockerfile & Jenkinsfile
This commit is contained in:
4
Dockerfile
Normal file
4
Dockerfile
Normal file
@@ -0,0 +1,4 @@
|
||||
FROM amazoncorretto:17.0.8-alpine3.17
|
||||
EXPOSE 8080
|
||||
ADD /target/gepafin-0.0.1-SNAPSHOT.jar gepafin-0.0.1-SNAPSHOT.jar
|
||||
ENTRYPOINT ["java", "-jar","gepafin-0.0.1-SNAPSHOT.jar"]
|
||||
64
Jenkinsfile
vendored
Normal file
64
Jenkinsfile
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
pipeline {
|
||||
agent any
|
||||
options {
|
||||
buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '5', daysToKeepStr: '', numToKeepStr: '5')
|
||||
}
|
||||
stages {
|
||||
stage('Develop Branch Deploy Code') {
|
||||
when {
|
||||
branch 'develop'
|
||||
}
|
||||
environment {
|
||||
github_branch = "develop"
|
||||
dockerimagename = "devteambflows/gepafin-api-dev"
|
||||
dockerImage = ""
|
||||
registryCredential = 'dockerhublogin'
|
||||
}
|
||||
steps {
|
||||
git branch: "${github_branch}", url: 'https://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@github.com/Kitzanos/GEPAFIN-BE.git'
|
||||
script {
|
||||
sh '/usr/share/maven/bin/mvn clean install -Dmaven.test.skip=true -Dspring.profiles.active=dev'
|
||||
}
|
||||
script {
|
||||
dockerImage = docker.build dockerimagename
|
||||
}
|
||||
script {
|
||||
docker.withRegistry('https://registry.hub.docker.com', registryCredential) {
|
||||
dockerImage.push("latest")
|
||||
}
|
||||
}
|
||||
script {
|
||||
sh 'ssh ubuntu@jenkins-server1.bflows.ai "sh gepafin-dev-api.sh"'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Production Branch Deploy Code') {
|
||||
when {
|
||||
branch 'master'
|
||||
}
|
||||
environment {
|
||||
github_branch = "master"
|
||||
dockerimagename = "devteambflows/gepafin-api-production"
|
||||
dockerImage = ""
|
||||
registryCredential = 'dockerhublogin'
|
||||
}
|
||||
steps {
|
||||
git branch: "${github_branch}", url: 'https://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@github.com/Kitzanos/GEPAFIN-BE.git'
|
||||
script {
|
||||
sh '/usr/share/maven/bin/mvn clean install -Dmaven.test.skip=true -Dspring.profiles.active=production'
|
||||
}
|
||||
script {
|
||||
dockerImage = docker.build dockerimagename
|
||||
}
|
||||
script {
|
||||
docker.withRegistry('https://registry.hub.docker.com', registryCredential) {
|
||||
dockerImage.push("latest")
|
||||
}
|
||||
}
|
||||
script {
|
||||
sh 'ssh ubuntu@46.105.65.89 "sh gepafin-production-api.sh"'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user