Skip to content
This repository has been archived by the owner on Aug 14, 2024. It is now read-only.

Commit

Permalink
Jenkins pipeline to build image
Browse files Browse the repository at this point in the history
  • Loading branch information
nmcc1212 committed May 17, 2024
1 parent 4fc7a27 commit ce65797
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions newAPI/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
pipeline {
agent any

environment {
DOCKERHUB_CREDENTIALS = credentials('nial-dockerhub-credentials')
DOCKERHUB_REPO = 'nial538/newapi-api'
}

stages {
stage('Checkout') {
steps {
checkout scm
}
}

stage('Build Docker Image') {
steps {
script {
dockerImage = docker.build("${DOCKERHUB_REPO}")
}
}
}

stage('Push Docker Image') {
steps {
script {
docker.withRegistry('https://index.docker.io/v1/', 'DOCKERHUB_CREDENTIALS') {
dockerImage.push()
dockerImage.push('latest')
}
}
}
}
}

post {
always {
cleanWs()
}
}
}

0 comments on commit ce65797

Please sign in to comment.