File tree Expand file tree Collapse file tree 1 file changed +25
-5
lines changed
Expand file tree Collapse file tree 1 file changed +25
-5
lines changed Original file line number Diff line number Diff line change @@ -6,23 +6,43 @@ pipeline {
66 }
77
88 stages {
9- stage(' 0. 연결 확인! ' ) { steps { echo ' 스테이지 출발' } }
9+ stage(' 0. 자동화 확인1 ' ) { steps { echo ' 스테이지 출발' } }
1010
1111 stage(' 1. Build' ) {
1212 steps {
1313 echo ' Maven으로 빌드 시작'
1414 sh ' mvn clean package'
1515 }
16- }
17- stage(' 2. docker 버전 확인' ) {
16+ }
17+
18+ stage(' 2. Check Docker' ) {
1819 steps {
1920 sh ' docker version'
2021 }
2122 }
23+
2224 stage(' 3. Docker Build' ) {
2325 steps {
2426 sh ' docker build -t ex02-app:latest .'
2527 }
26- }
28+ }
29+
30+ stage(' 4. Docker Push' ) {
31+ steps {
32+ withCredentials([usernamePassword(
33+ credentialsId : ' dockerhub-cred' ,
34+ usernameVariable : ' DOCKERHUB_USERNAME' ,
35+ passwordVariable : ' DOCKERHUB_PASSWORD'
36+ )]) {
37+ sh '''
38+ echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
39+ docker tag ex02-app:latest $DOCKERHUB_USERNAME/ex02-app:latest
40+ docker push $DOCKERHUB_USERNAME/ex02-app:latest
41+ '''
42+ }
43+ }
44+ }
2745 }
28- }
46+ }
47+
48+
You can’t perform that action at this time.
0 commit comments