-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
36 lines (35 loc) · 1.45 KB
/
Jenkinsfile
File metadata and controls
36 lines (35 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
pipeline {
agent none
stages {
stage('Gradle build'){
agent any
steps{
dir('BE') {sh 'chmod +x ./gradlew'} // 권한 추가
dir('BE') {sh './gradlew clean build'} // 빌드
}
}
stage('Docker build') {
agent any
steps {
sh 'docker build -t backimg ./BE' //도커 이미지 빌드
}
}
stage('Docker run') {
agent any
steps {
sh 'docker ps -f name=back -q \
| xargs --no-run-if-empty docker container stop' // 실행 중인 컨테이너 중지
sh 'docker container ls -a -f name=back -q \
| xargs -r docker container rm' // 이전 컨테이너 삭제
sh 'docker run -v /home/files:/home/files -e JAVA_OPTS=-Djasypt.encryptor.password=gumid201 -e TZ=Asia/Seoul -d --name back -p 8090:8090 backimg' // 도커 이미지 실행, Jasypt 암호 입력
}
}
stage('Remove Images'){
agent any
steps {
sh 'docker container prune -f'
sh 'docker image prune -f' // 이전 이미지, 컨테이너 모두 삭제
}
}
}
}