-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
38 lines (37 loc) · 1.1 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
pipeline {
agent any
stages {
stage('Checkout SCM') {
steps {
git url: 'https://github.com/Anjaneyulu8106/week2.git', credentialsId: 'docker-hub-credentials'
}
}
stage('Login to Docker Hub') {
steps {
withCredentials([usernamePassword(credentialsId: 'docker-hub-credentials', usernameVariable: 'DOCKER_USER', passwordVariable: 'DOCKER_PASS')]) {
script {
// Use bat for Windows
bat "echo %DOCKER_PASS% | docker login -u %DOCKER_USER% --password-stdin"
}
}
}
}
stage('Build') {
steps {
bat 'docker build -t my-nodejs-app .'
}
}
stage('Test') {
steps {
echo 'Running tests...'
// Add test commands here
}
}
stage('Deploy') {
steps {
echo 'Deploying application...'
// Add deploy commands here
}
}
}
}