-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
37 lines (34 loc) · 1.05 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
pipeline {
agent any
stages {
stage('preparation') {
steps {
// Get some code from a GitHub repository
git branch: 'main', url: 'https://github.com/hazemhashem881/Demo1.git'
}
}
stage('build'){
steps{
sh 'docker build -t hazemhashem100/demo1 .'
}
}
stage('artifact ') {
steps {
withCredentials([usernamePassword(credentialsId: 'dockerhub', passwordVariable: 'PASSWORD', usernameVariable: 'USERNAME')]) {
sh 'docker login -u ${USERNAME} -p ${PASSWORD}'
sh 'docker push hazemhashem100/demo1'
}
}
}
stage('cd'){
steps{
sh "docker run -d -p 3000:80 hazemhashem100/demo1"
}
}
}
post{
success{
slackSend channel: "general",color: "#439FE0", message: " Successed: ${env.JOB_NAME} ${env.BUILD_NUMBER}"
}
}
}