Skip to content

Commit 7edded3

Browse files
committed
1647
1 parent 84c538e commit 7edded3

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

Jenkinsfile

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff 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+

0 commit comments

Comments
 (0)