-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
64 lines (64 loc) · 1.72 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
pipeline {
agent any
environment {
DOCKERHUB_CREDENTIALS= credentials('docker-hub')
}
stages {
stage("Git Checkout"){
steps{
git credentialsId: 'github', url: 'https://github.com/tamartayar/personal-project.git/'
echo 'Git Checkout Completed'
}
}
stage("build"){
steps{
sh '''
cd super-app
docker compose build --no-cache
docker tag tamartayar/personal-project:node tamartayar/personal-project:node.$BUILD_NUMBER
docker tag tamartayar/personal-project:php tamartayar/personal-project:php.$BUILD_NUMBER
'''
}
}
stage("run"){
steps{
sh '''
cd super-app
docker compose up -d
sleep 3
'''
}
}
stage("tests"){
steps{
sh '''
cd super-app
curl localhost:8088
curl localhost:3000/super-app
'''
}
}
stage('Login to Docker Hub') {
steps{
sh '''
docker login -u $DOCKERHUB_CREDENTIALS_USR -p$DOCKERHUB_CREDENTIALS_PSW
echo Login Completed
'''
}
}
stage('Push Image to Docker Hub') {
steps{
sh '''
docker push tamartayar/personal-project:node.$BUILD_NUMBER
docker push tamartayar/personal-project:php.$BUILD_NUMBER
echo Push Image Completed
'''
}
}
}
post{
always {
sh 'docker logout'
}
}
}