Skip to content

Commit

Permalink
Edit Build Image stage dicodingacademy#5
Browse files Browse the repository at this point in the history
  • Loading branch information
slehmadi committed Jul 28, 2023
1 parent 24e0d8e commit 45deb10
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,6 @@ node {
checkout scm
sh './jenkins/scripts/test.sh'
}
stage('Build image') {
checkout scm
docker.image('ubuntu:alpine') {
withCredentials([usernamePassword(credentialsId: 'docker-hub-creds', usernameVariable: 'USER', passwordVariable: 'PASS')]) {
sh 'docker build -t slehmadi/react-app-cicd-dicoding .'
sh 'docker login -u $USER -p $PASS'
sh 'docker push slehmadi/react-app-cicd-dicoding'
}
}
}
stage('Manual Approval') {
checkout scm
input message: 'Lanjutkan ke tahap Deploy?'
Expand All @@ -29,4 +19,15 @@ node {
sh './jenkins/scripts/kill.sh'
}
}
docker.image('ubuntu:alpine').inside('-p 3000:3000') {
stage('Build Image') {
checkout scm
sh 'apt update && apt install docker.io -y'
withCredentials([usernamePassword(credentialsId: 'docker-hub-creds', usernameVariable: 'USER', passwordVariable: 'PASS')]) {
sh 'docker build -t slehmadi/react-app-cicd-dicoding .'
sh 'docker login -u $USER -p $PASS'
sh 'docker push slehmadi/react-app-cicd-dicoding'
}
}
}
}

0 comments on commit 45deb10

Please sign in to comment.