Skip to content

Commit

Permalink
Merge branch 'master' into SHIBUI-836
Browse files Browse the repository at this point in the history
  • Loading branch information
dima767 committed Sep 17, 2018
2 parents 427f509 + 37e8347 commit f8aa90b
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
52 changes: 52 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
pipeline {
agent any
options {
disableConcurrentBuilds()
buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10'))
}
stages {
stage('Build') {
steps {
sh './gradlew clean build'
}
post {
always {
junit 'backend/build/test-results/**/*.xml'
jacoco execPattern: '**/build/jacoco/test.exec'
}
}
}
stage('Build Docker images') {
when {
expression {
return GIT_BRANCH in ['master']
}
}
steps {
sh '''./gradlew docker
'''
}
}
stage('Deploy') {
when {
expression {
return GIT_BRANCH in ['master']
}
}
steps {
sh '''
docker stop shibui || true && docker rm shibui || true
docker run -d --restart always --name shibui -p 8080:8080 -v /etc/shibui/application.properties:/application.properties unicon/shibui:latest
'''
}
}
}
post {
failure {
step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: emailextrecipients([[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']])])
}
success {
emailext body: '''${SCRIPT, template="groovy-text.template"}''', recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']], subject: '[SHIBUI] Build Success'
}
}
}
9 changes: 9 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM gcr.io/distroless/java

ARG JAR_FILE

COPY ${JAR_FILE} app.jar

EXPOSE 8080

CMD ["app.jar"]
11 changes: 11 additions & 0 deletions backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
id 'com.gorylenko.gradle-git-properties' version '1.4.21'
id 'net.researchgate.release' version '2.6.0'
id 'io.franzbecker.gradle-lombok' version '1.13'
id 'com.palantir.docker' version '0.20.1'
}

apply plugin: 'io.spring.dependency-management'
Expand Down Expand Up @@ -206,4 +207,14 @@ jacocoTestReport {
csv.enabled = false
html.destination = file("${buildDir}/jacocoHtml")
}
}

tasks.docker.dependsOn tasks.build
docker {
name 'unicon/shibui'
tags 'latest'
pull true
noCache true
files tasks.bootWar.outputs
buildArgs(['JAR_FILE': 'shibui.war'])
}

0 comments on commit f8aa90b

Please sign in to comment.