Skip to content

Commit 24e0d8e

Browse files
committed
Edit Build Image stage dicodingacademy#5
1 parent d0f8e8b commit 24e0d8e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Jenkinsfile

+6-5
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ node {
1010
}
1111
stage('Build image') {
1212
checkout scm
13-
sh 'apt update && apt install docker.io -y'
14-
withCredentials([usernamePassword(credentialsId: 'docker-hub-creds', usernameVariable: 'USER', passwordVariable: 'PASS')]) {
15-
sh 'docker build -t slehmadi/react-app-cicd-dicoding .'
16-
sh 'docker login -u $USER -p $PASS'
17-
sh 'docker push slehmadi/react-app-cicd-dicoding'
13+
docker.image('ubuntu:alpine') {
14+
withCredentials([usernamePassword(credentialsId: 'docker-hub-creds', usernameVariable: 'USER', passwordVariable: 'PASS')]) {
15+
sh 'docker build -t slehmadi/react-app-cicd-dicoding .'
16+
sh 'docker login -u $USER -p $PASS'
17+
sh 'docker push slehmadi/react-app-cicd-dicoding'
18+
}
1819
}
1920
}
2021
stage('Manual Approval') {

0 commit comments

Comments
 (0)