Jenkins file edit
Some checks failed
test/timeline-frontend/pipeline/head There was a failure building this commit
Some checks failed
test/timeline-frontend/pipeline/head There was a failure building this commit
This commit is contained in:
19
Jenkinsfile
vendored
19
Jenkinsfile
vendored
@@ -158,20 +158,7 @@ pipeline {
|
||||
stage('Deploy to Environment') {
|
||||
steps {
|
||||
script {
|
||||
// 创建或更新docker-compose文件
|
||||
def composeContent = deployToEnvironmentWithCompose('dev')
|
||||
writeFile file: 'docker-compose.yml', text: composeContent
|
||||
|
||||
// 拉取最新镜像
|
||||
sh 'docker compose pull'
|
||||
|
||||
// 停止旧容器
|
||||
sh 'docker compose down || true'
|
||||
|
||||
// 启动新容器
|
||||
sh 'docker compose up -d'
|
||||
|
||||
echo "所有服务已部署完成"
|
||||
deployToEnvironmentWithCompose('dev')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -249,12 +236,12 @@ def deployToEnvironmentWithCompose(String env) {
|
||||
|
||||
// 停止现有服务
|
||||
sh """
|
||||
docker-compose -f docker-compose.yml down || true
|
||||
docker compose -f docker-compose.yml down || true
|
||||
"""
|
||||
|
||||
// 启动新服务
|
||||
sh """
|
||||
docker-compose -f docker-compose.yml up -d
|
||||
docker compose -f docker-compose.yml up -d
|
||||
"""
|
||||
|
||||
// 验证部署
|
||||
|
||||
Reference in New Issue
Block a user