Skip to content

Commit 45deb10

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

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

Jenkinsfile

+11-10
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,6 @@ node {
88
checkout scm
99
sh './jenkins/scripts/test.sh'
1010
}
11-
stage('Build image') {
12-
checkout scm
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-
}
19-
}
20-
}
2111
stage('Manual Approval') {
2212
checkout scm
2313
input message: 'Lanjutkan ke tahap Deploy?'
@@ -29,4 +19,15 @@ node {
2919
sh './jenkins/scripts/kill.sh'
3020
}
3121
}
22+
docker.image('ubuntu:alpine').inside('-p 3000:3000') {
23+
stage('Build Image') {
24+
checkout scm
25+
sh 'apt update && apt install docker.io -y'
26+
withCredentials([usernamePassword(credentialsId: 'docker-hub-creds', usernameVariable: 'USER', passwordVariable: 'PASS')]) {
27+
sh 'docker build -t slehmadi/react-app-cicd-dicoding .'
28+
sh 'docker login -u $USER -p $PASS'
29+
sh 'docker push slehmadi/react-app-cicd-dicoding'
30+
}
31+
}
32+
}
3233
}

0 commit comments

Comments
 (0)