-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
45 lines (36 loc) · 1.06 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
pipeline {
agent any
stages {
stage('Checkout') {
steps {
echo 'Starting checkout of the source code...'
checkout scm
echo 'Checkout completed.'
}
}
stage('Build Docker Image') {
steps {
script {
echo 'Starting Docker image build...'
// Build the Docker image using the Dockerfile in the repository
dockerImage = docker.build("nlarison/jenkins_test:${env.BUILD_ID}")
// Log message after successful build
echo "Docker image build completed: nlarison/jenkins_test:${env.BUILD_ID}"
}
}
}
stage('Push Docker Image') {
steps {
script {
echo 'Starting Docker image push to Docker Hub...'
// Push the Docker image to Docker Hub or another registry
docker.withRegistry('https://registry.hub.docker.com', 'docker-hub-login') {
dockerImage.push()
}
// Log message after successful push
echo 'Docker image push completed successfully.'
}
}
}
}
}