-
Notifications
You must be signed in to change notification settings - Fork 13
/
Jenkinsfile.win
29 lines (28 loc) · 1.21 KB
/
Jenkinsfile.win
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
node {
git poll: true, url: 'https://github.com/subicura/docker-jenkins-workshop.git'
withEnv(["DOCKER_HOST=tcp://docker.for.win.localhost:2375"]) {
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'dockerhub',
usernameVariable: 'DOCKER_USER_ID', passwordVariable: 'DOCKER_USER_PASSWORD']]) {
stage('Pull') {
git 'https://github.com/subicura/docker-jenkins-workshop.git'
}
stage('Unit Test') {
sh(script: 'docker-compose run --rm unit')
}
stage('Build') {
sh(script: 'docker-compose build app')
}
stage('Tag') {
sh(script: 'docker tag ${DOCKER_USER_ID}/ruby-app ${DOCKER_USER_ID}/ruby-app:${BUILD_NUMBER}')
}
stage('Push') {
sh(script: 'docker login -u ${DOCKER_USER_ID} -p ${DOCKER_USER_PASSWORD}')
sh(script: 'docker push ${DOCKER_USER_ID}/ruby-app:${BUILD_NUMBER}')
sh(script: 'docker push ${DOCKER_USER_ID}/ruby-app:latest')
}
stage('Deploy') {
sh(script: 'docker-compose up -d production')
}
}
}
}