使用宿主机docker构建

This commit is contained in:
2025-07-18 16:27:25 +08:00
parent 286fdada6e
commit 6b60dc8577

12
Jenkinsfile vendored
View File

@ -5,9 +5,9 @@ pipeline {
filename "Dockerfile.buildagent"
}
}
tools {
maven 'M3' // 必须在 Jenkins → Manage Jenkins → Global Tool Configuration 中配置过
}
// tools {
// maven 'M3' // 必须在 Jenkins → Manage Jenkins → Global Tool Configuration 中配置过
// }
environment {
APP_NAME = "sczx_web"
DOCKER_IMAGE = "${APP_NAME}:latest"
@ -39,6 +39,7 @@ pipeline {
// 检查是否可以使用宿主机docker
stage('Check Docker') {
steps {
echo "🔍 检查宿主机 Docker 版本..."
sh 'which docker && docker --version'
}
}
@ -46,10 +47,7 @@ pipeline {
stage('Build Docker Image') {
steps {
echo "🐋 正在构建 Docker 镜像..."
script {
// 使用宿主机的 docker不在构建容器中执行 docker build
sh 'docker build -t $DOCKER_IMAGE .'
}
sh 'docker build -t "$DOCKER_IMAGE" .'
}
}