[👷] Jenkins Test
Some checks failed
Front/pipeline/head There was a failure building this commit

This commit is contained in:
김선규 2024-07-12 12:36:50 +09:00
parent 4454ec8df6
commit 7c7a9d4fd7

50
Jenkinsfile vendored
View File

@ -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"
}
}
}
}
}
}