We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 752349c commit e2f480dCopy full SHA for e2f480d
Jenkinsfile
@@ -0,0 +1,37 @@
1
+pipeline {
2
+ agent any
3
+
4
+ environment {
5
+ IMAGE_NAME = "your-dockerhub-username/java-web-calculator"
6
+ }
7
8
+ stages {
9
+ stage('Clone Repo') {
10
+ steps {
11
+ echo 'Code already cloned by Jenkins.'
12
13
14
15
+ stage('Build Docker Image') {
16
17
+ script {
18
+ sh 'docker build -t $IMAGE_NAME .'
19
20
21
22
23
+ stage('Login to Docker Hub') {
24
25
+ withCredentials([usernamePassword(credentialsId: 'docker-hub-creds', usernameVariable: 'DOCKER_USER', passwordVariable: 'DOCKER_PASS')]) {
26
+ sh 'echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin'
27
28
29
30
31
+ stage('Push to Docker Hub') {
32
33
+ sh 'docker push $IMAGE_NAME'
34
35
36
37
+}
0 commit comments