This commit is contained in:
parent
4454ec8df6
commit
7c7a9d4fd7
36
Jenkinsfile
vendored
36
Jenkinsfile
vendored
|
@ -1,10 +1,42 @@
|
|||
pipeline {
|
||||
agent any
|
||||
|
||||
environment {
|
||||
DOCKER_CONTAINER_NAME = 'stein-node'
|
||||
APP_VOLUME_FRONT = '/home/node/front' // 컨테이너 내부 경로
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('stage 1') {
|
||||
stage('Clone Repository') {
|
||||
steps {
|
||||
echo "Stein Front Push"
|
||||
git url: 'http://your-gitea-repo2-url.git', branch: 'main'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build and Test') {
|
||||
steps {
|
||||
dir('front') {
|
||||
sh 'npm install'
|
||||
sh 'npm test'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Deploy') {
|
||||
steps {
|
||||
script {
|
||||
// Docker 컨테이너 ID 가져오기
|
||||
def containerId = sh(script: "docker ps -qf 'name=${DOCKER_CONTAINER_NAME}'", returnStdout: true).trim()
|
||||
if (containerId) {
|
||||
// 컨테이너 내부로 파일 복사
|
||||
sh "docker cp ${WORKSPACE}/front/. ${containerId}:${APP_VOLUME_FRONT}"
|
||||
// 컨테이너 재시작
|
||||
sh "docker restart ${containerId}"
|
||||
} else {
|
||||
error "Docker container ${DOCKER_CONTAINER_NAME} not found"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user