From 2474842c8b5d0c5791d62a5c4760caebc67cd636 Mon Sep 17 00:00:00 2001 From: jianghao <332515344@qq.com> Date: Mon, 29 Dec 2025 14:36:47 +0800 Subject: [PATCH] Jenkins build --- Jenkinsfile | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b13fa72..cbd6b0c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,17 +40,18 @@ pipeline { stage('Build timeline-frontend dist') { steps { script { - sh "pwd && ls" - // 使用 Docker 运行 Node.js 环境 - sh ''' - docker run -v $PWD:/app -w /app node:18-alpine sh -c " - npm install && - npm run build - " - ''' + def workspace = pwd + echo "当前工作空间路径: $ {workspace}" - // 验证构建产物 - sh 'ls -la dist/' + // 确保路径正确 + sh "ls -la $ {workspace}" + + // 修复权限问题 + sh "chmod -R 755 $ {workspace}" + sh "chown -R jenkins:jenkins $ {workspace}" + + // 使用更健壮的Docker命令 + sh "docker run -u $ (id -u): $ (id -g) -v $ {workspace}:/app -w /app node:18-alpine sh -c 'npm install && npm run build'" } } }