-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
30 lines (28 loc) · 1.02 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
pipeline {
agent any
environment {
GS_SLACK_TOKEN = credentials('GS_SLACK_TOKEN')
GS_SLACK_DIRECT_MESSAGE_ID = credentials('GS_SLACK_DIRECT_MESSAGE_ID')
}
stages {
stage('Docker Build') {
steps {
echo '==> Docker Build'
sh 'sudo docker build -t notification-service --no-cache .'
}
}
stage('Docker Stop Container') {
steps {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
echo '==> Stopping container'
sh 'sudo docker rm $(sudo docker ps -aqf "name=notification-service") -f'
}
}
}
stage('Docker Run Container') {
steps {
sh 'sudo docker run -p 1111:8080 -e GS_SLACK_TOKEN=$GS_SLACK_TOKEN -e GS_SLACK_DIRECT_MESSAGE_ID=$GS_SLACK_DIRECT_MESSAGE_ID --name notification-service --restart=always --detach notification-service'
}
}
}
}