forked from Glintt/gAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
47 lines (37 loc) · 1.53 KB
/
Jenkinsfile
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
node{
env.BUILD_VERSION = "${params.version}".trim()
env.DOCKER_USER = "${env.DOCKER_USER}"
stage('Clone repository') {
checkout scm
}
stage('Build docker images') {
dir('api') {
sh "docker image build -t $DOCKER_USER/gapi-backend:$BUILD_VERSION -f Dockerfile ."
sh "docker image build -t $DOCKER_USER/gapi-backend -f Dockerfile ."
}
dir('api') {
sh "docker image build -t $DOCKER_USER/gapi-rabbitlistener:$BUILD_VERSION -f Dockerfile-rabbitlistener ."
sh "docker image build -t $DOCKER_USER/gapi-rabbitlistener -f Dockerfile-rabbitlistener ."
}
dir('dashboard') {
sh "docker image build -t $DOCKER_USER/gapi-dashboard:$BUILD_VERSION ."
sh "docker image build -t $DOCKER_USER/gapi-dashboard ."
}
}
stage('Publish docker images') {
sh "docker push $DOCKER_USER/gapi-backend:$BUILD_VERSION"
sh "docker push $DOCKER_USER/gapi-backend"
sh "docker push $DOCKER_USER/gapi-rabbitlistener:$BUILD_VERSION"
sh "docker push $DOCKER_USER/gapi-rabbitlistener"
sh "docker push $DOCKER_USER/gapi-dashboard:$BUILD_VERSION"
sh "docker push $DOCKER_USER/gapi-dashboard"
}
stage('Remove docker images from build machine') {
sh "docker image rm -f $DOCKER_USER/gapi-backend:$BUILD_VERSION"
sh "docker image rm -f $DOCKER_USER/gapi-backend"
sh "docker image rm -f $DOCKER_USER/gapi-rabbitlistener:$BUILD_VERSION"
sh "docker image rm -f $DOCKER_USER/gapi-rabbitlistener"
sh "docker image rm -f $DOCKER_USER/gapi-dashboard:$BUILD_VERSION"
sh "docker image rm -f $DOCKER_USER/gapi-dashboard"
}
}