This commit is contained in:
parent
4454ec8df6
commit
7c7a9d4fd7
50
Jenkinsfile
vendored
50
Jenkinsfile
vendored
|
@ -1,10 +1,42 @@
|
||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent any
|
||||||
stages {
|
|
||||||
stage('stage 1') {
|
environment {
|
||||||
steps {
|
DOCKER_CONTAINER_NAME = 'stein-node'
|
||||||
echo "Stein Front Push"
|
APP_VOLUME_FRONT = '/home/node/front' // 컨테이너 내부 경로
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
stages {
|
||||||
}
|
stage('Clone Repository') {
|
||||||
|
steps {
|
||||||
|
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