From 60c3cd2332cdcbd92a552e098598129e6ea6de90 Mon Sep 17 00:00:00 2001 From: jianghao <332515344@qq.com> Date: Mon, 29 Dec 2025 15:35:36 +0800 Subject: [PATCH] Jenkins build --- Jenkinsfile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 42632ad..48080a0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -45,13 +45,15 @@ pipeline { // 确保路径正确 sh "ls -la ${workspace}" + sh "npm -v" + sh "npm install && npm run build" // 修复权限问题 - sh "chmod -R 755 ${workspace}" - sh "chown -R jenkins:jenkins ${workspace}" - - // 使用绝对路径挂载工作目录到容器中,并确保所有命令都在容器内执行 - sh 'docker run --rm -v "${PWD}:/app" -w /app node:18-alpine sh -c \'if [ -f "package.json" ]; then echo "package.json found"; npm install && npm run build; else echo "package.json not found"; exit 1; fi\'' +// sh "chmod -R 755 ${workspace}" +// sh "chown -R jenkins:jenkins ${workspace}" +// +// // 使用绝对路径挂载工作目录到容器中,并确保所有命令都在容器内执行 +// sh 'docker run --rm -v "${PWD}:/app" -w /app node:18-alpine sh -c \'if [ -f "package.json" ]; then echo "package.json found"; npm install && npm run build; else echo "package.json not found"; exit 1; fi\'' // 检查构建是否生成了 dist 目录 sh 'ls -la'