Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/dockerfiles #259

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Example Voting App
=========

This is a sample instavote application

Getting started
---------------

Expand Down
11 changes: 11 additions & 0 deletions worker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM maven:3.6.1-jdk-8-slim

WORKDIR /app

COPY . .

RUN mvn package && \
mv target/worker-jar-with-dependencies.jar /run/worker.jar && \
rm -rf /app/*

CMD java -jar /run/worker.jar
51 changes: 51 additions & 0 deletions worker/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
pipeline {
agent {
docker{
image 'maven:3.6.1-jdk-8-slim'
args '-v $HOME/.m2:/root/.m2'
}
}

stages{
stage("build"){
when{
changeset "**/worker/**"
}
steps{
echo 'Compiling worker app'
dir('worker'){
sh 'mvn compile'
}
}
}
stage("test"){
when{
changeset "**/worker/**"
}
steps{
echo 'Running Unit Tests on worker app'
dir('worker'){
sh 'mvn clean test'
}
}
}
stage("package"){
when{
branch 'master'
changeset "**/worker/**"
}
steps{
echo 'Packaging worker app'
dir('worker'){
sh 'mvn package -DskipTests'
}
}
}
}
post{
always{
archiveArtifacts artifacts: '**/target/*.jar', fingerprint: true
echo 'Building multibranch pipeline for worker is completed..'
}
}
}