登录和注册接口
This commit is contained in:
29
Jenkinsfile
vendored
29
Jenkinsfile
vendored
@ -1,8 +1,8 @@
|
||||
pipeline {
|
||||
agent any
|
||||
tools {
|
||||
maven 'M3' // 必须在 Jenkins → Manage Jenkins → Global Tool Configuration 中配置过
|
||||
}
|
||||
// tools {
|
||||
// maven 'M3' // 必须在 Jenkins → Manage Jenkins → Global Tool Configuration 中配置过
|
||||
// }
|
||||
environment {
|
||||
APP_NAME = "sczx_user"
|
||||
DOCKER_IMAGE = "${APP_NAME}:latest"
|
||||
@ -10,14 +10,19 @@ pipeline {
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
echo "📦 正在拉取代码..."
|
||||
git branch: 'main', url: 'http://115.190.8.52:3000/sczx_group/sczx_user.git'
|
||||
}
|
||||
}
|
||||
// stage('Checkout') {
|
||||
// steps {
|
||||
// echo "📦 正在拉取代码..."
|
||||
// git branch: 'main', url: 'http://115.190.8.52:3000/sczx_group/sczx_user.git'
|
||||
// }
|
||||
// }
|
||||
|
||||
stage('Build with Maven') {
|
||||
stage('Build with Maven in JDK 8') {
|
||||
agent {
|
||||
dockerfile {
|
||||
filename "Dockerfile.buildagent"
|
||||
}
|
||||
}
|
||||
steps {
|
||||
echo "🛠️ 正在使用 Maven 构建..."
|
||||
sh 'mvn clean package -s settings.xml'
|
||||
@ -25,12 +30,14 @@ pipeline {
|
||||
}
|
||||
|
||||
stage('Check Jar File') {
|
||||
agent any
|
||||
steps {
|
||||
sh 'ls -la target/' // 确保 jar 文件存在
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build Docker Image') {
|
||||
agent any
|
||||
steps {
|
||||
echo "🐋 正在构建 Docker 镜像..."
|
||||
sh """
|
||||
@ -40,6 +47,7 @@ pipeline {
|
||||
}
|
||||
|
||||
stage('Stop Old Container') {
|
||||
agent any
|
||||
steps {
|
||||
echo "🛑 正在停止旧的容器(如果存在)..."
|
||||
sh '''
|
||||
@ -52,6 +60,7 @@ pipeline {
|
||||
}
|
||||
|
||||
stage('Run New Container') {
|
||||
agent any
|
||||
steps {
|
||||
echo "🟢 正在运行新的容器..."
|
||||
sh """
|
||||
|
||||
Reference in New Issue
Block a user