Skip to content

Commit aa72700

Browse files
author
yuryshakhov
committed
add repo and auth to docker
1 parent 7210ddd commit aa72700

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

jenkinsFiles/dockerBuild.jenkins

+19-1
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,31 @@ pipeline {
1212
timestamps()
1313
}
1414
stages {
15+
stage("docker login") {
16+
steps {
17+
echo " ============== docker login =================="
18+
withCredentials([usernamePassword(credentialsId: 'dockerhub_username', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
19+
sh """
20+
docker login -u $USERNAME -p $PASSWORD
21+
"""
22+
}
23+
}
24+
}
1525
stage("create docker image") {
1626
steps {
1727
echo " ============== start building image =================="
1828
dir ('docker/toolbox') {
19-
sh 'docker build . '
29+
sh 'docker build -t drblack666/toolbox:latest . '
2030
}
2131
}
2232
}
33+
stage("docker push") {
34+
steps {
35+
echo " ============== start pushing image =================="
36+
sh '''
37+
docker push drblack666/toolbox:latest
38+
'''
39+
}
40+
}
2341
}
2442
}

0 commit comments

Comments
 (0)