-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
43 lines (38 loc) · 1.16 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
pipeline {
agent any
environment {
DOCKERHUB_CREDENTIALS = credentials('b4baf9b8-3711-4c81-9d90-2259b81ddfd8')
}
stages {
stage('Checkout') {
steps {
git url: 'https://github.com/owerrride/flask-app.git', branch: 'main'
}
}
stage('Build') {
steps {
script {
def app = docker.build("owerrride/owerrr-test-app")
}
}
}
stage('Push to DockerHub') {
steps {
script {
docker.withRegistry('https://index.docker.io/v1/', 'DOCKERHUB_CREDENTIALS') {
docker.image("owerrride/owerrr-test-app").push("${env.BUILD_NUMBER}")
}
}
}
}
stage('Deploy') {
steps {
script {
sshagent(['b6048694-8f55-4b67-8406-da4108cc4b33']) {
sh 'ssh admin@35.158.210.241 "sudo docker pull owerrride/owerrr-test-app:${env.BUILD_NUMBER} && docker-compose up -d"'
}
}
}
}
}
}