generated from gCubeCI/Pipeline-Docker-Template
First commit.
This commit is contained in:
parent
75a8938ba6
commit
3ea0e38209
|
@ -0,0 +1,8 @@
|
||||||
|
FROM openjdk:17
|
||||||
|
|
||||||
|
RUN mkdir -p /opt/shinyproxy
|
||||||
|
RUN wget https://shinyproxy.io/downloads/shinyproxy-3.1.0.jar -O /opt/shinyproxy/shinyproxy.jar
|
||||||
|
|
||||||
|
WORKDIR /opt/shinyproxy
|
||||||
|
CMD ["java", "-jar", "/opt/shinyproxy/shinyproxy.jar"]
|
||||||
|
|
|
@ -9,18 +9,19 @@ pipeline {
|
||||||
label 'docker'
|
label 'docker'
|
||||||
}
|
}
|
||||||
environment {
|
environment {
|
||||||
imagename = "" //TO FILL WITH THE RIGHT VALUE (RepositoryName) e.g. d4science/RepositoryName
|
imagename = "external-services/shinyproxy"
|
||||||
registryCredential = 'e348bfab-5580-4db6-b0e0-d854966bde08'
|
hubname = "hub.dev.d4science.org"
|
||||||
dockerImage = ''
|
registryUrl = "https://hub.dev.d4science.org"
|
||||||
git_url='' // SET HERE THE URL OF YOUR NEW GIT PROJECT
|
registryCredential = 'harbor-dev-external-services'
|
||||||
|
dockerImage = ''
|
||||||
|
git_url='https://code-repo.d4science.org/InfraScience/shinyproxy-infrascience.git'
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('Cloning Git') {
|
// stage('Cloning Git') {
|
||||||
steps {
|
// steps {
|
||||||
git([url: git_url, branch: 'master', credentialsId: '88b54962-1c0e-49cb-8155-22276860f346'])
|
// git([url: git_url, branch: 'main', credentialsId: ''])
|
||||||
|
// }
|
||||||
}
|
// }
|
||||||
}
|
|
||||||
stage('Building image') {
|
stage('Building image') {
|
||||||
steps{
|
steps{
|
||||||
script {
|
script {
|
||||||
|
@ -31,18 +32,17 @@ pipeline {
|
||||||
stage('Deploy Image') {
|
stage('Deploy Image') {
|
||||||
steps{
|
steps{
|
||||||
script {
|
script {
|
||||||
docker.withRegistry( '', registryCredential ) {
|
docker.withRegistry( registryUrl, registryCredential ) {
|
||||||
dockerImage.push("$BUILD_NUMBER")
|
dockerImage.push("$BUILD_NUMBER")
|
||||||
dockerImage.push('latest')
|
dockerImage.push('latest')
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Remove Unused docker image') {
|
stage('Remove Unused docker image') {
|
||||||
steps{
|
steps{
|
||||||
sh "docker rmi $imagename:$BUILD_NUMBER"
|
sh "docker rmi $hubname/$imagename:$BUILD_NUMBER"
|
||||||
sh "docker rmi $imagename:latest"
|
sh "docker rmi $hubname/$imagename:latest"
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,9 +50,9 @@ pipeline {
|
||||||
// post-build actions
|
// post-build actions
|
||||||
post {
|
post {
|
||||||
success {
|
success {
|
||||||
echo 'The docker pipeline worked!'
|
echo 'The shinyproxy docker pipeline worked!'
|
||||||
emailext to: 'jenkinsbuilds@d4science.org',
|
emailext to: 'jenkinsbuilds@d4science.org',
|
||||||
subject: "[Jenkins DockerPipeline D4S] build ${currentBuild.fullDisplayName} worked",
|
subject: "[Jenkins Docker Pipeline D4S] ${currentBuild.fullDisplayName} build worked",
|
||||||
body: "Build time: ${currentBuild.durationString}. See ${env.BUILD_URL}"
|
body: "Build time: ${currentBuild.durationString}. See ${env.BUILD_URL}"
|
||||||
}
|
}
|
||||||
failure {
|
failure {
|
||||||
|
@ -64,3 +64,4 @@ pipeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
13
README.md
13
README.md
|
@ -1,12 +1,5 @@
|
||||||
# Pipeline-Docker-Template
|
# Shinyproxy
|
||||||
|
|
||||||
This is a template useful for building docker images and push to dockerhub.
|
Jenkins pipeline that builds shinyproxy. The main branch tags the built image as "latest".
|
||||||
There is a jenkinsjob template on our jenkins with the same name.
|
Create a branch and add a corresponding Jenkins job if you want to build a specific version.
|
||||||
|
|
||||||
|
|
||||||
## USAGE TIPS:
|
|
||||||
|
|
||||||
* REMEMBER TO FILL the jenkinsfile environment section with your values. The following field should be properly filled: imagename, git_url
|
|
||||||
* REMEMBER TO PUT your Dockerfile in the root folder of your new project
|
|
||||||
|
|
||||||
* You can find the related jenkinsjob template here: https://jenkins.d4science.org/job/Pipeline-Docker-Template/
|
|
||||||
|
|
Loading…
Reference in New Issue