1 Star 0 Fork 0

BANH/ruoyi-test

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Jenkinsfile 2.82 KB
一键复制 编辑 原始数据 按行查看 历史
奋斗奋斗a 提交于 2024-01-12 23:28 . a
pipeline {
agent {
label 'node-01'
}
environment {
IMAGE_PROJECT = 'ruoyi'
IMAGE_NAME = 'ruoyi-admin'
IMAGE_TAG = "v3.8.2"
REGISTRY_NAME = 'harbor.banh.com'
}
stages {
stage('checkout') {
steps {
checkout scmGit(
branches: [[name: '*/master']],
extensions: [],
userRemoteConfigs: [[
credentialsId: '6362b3c0-0cd5-4a12-9ee7-a0dd827bb54d',
url: '[email protected]:root/RuoYi-Vue.git'
]]
)
}
}
stage('Clean') {
steps {
sh """
docker rm -f ruoyi-admin ruoyi-nginx || true
docker image prune -f || true
docker rmi -f ${REGISTRY_NAME}/${IMAGE_PROJECT}/${IMAGE_NAME}:${IMAGE_TAG} || true
docker rmi -f ${REGISTRY_NAME}/${IMAGE_PROJECT}/ruoyi-nginx:${IMAGE_TAG} || true
"""
}
}
stage('Build') {
steps {
sh 'chmod +x ./mvnw && ./mvnw clean package -DskipTests'
sh "cd ruoyi-admin && docker build -t ${REGISTRY_NAME}/${IMAGE_PROJECT}/${IMAGE_NAME}:${IMAGE_TAG} ."
}
}
stage('Nvm Build') {
steps {
sh """
cd ruoyi-ui && npm install --registry=https://registry.npmmirror.com && \
npm run build:prod && \
docker build -t ${REGISTRY_NAME}/${IMAGE_PROJECT}/ruoyi-nginx:${IMAGE_TAG} .
"""
}
}
stage('Push Image') {
steps {
withCredentials([usernamePassword(
credentialsId: '4451a28c-f163-488e-8810-e0e71b9684dc',
passwordVariable: 'REGISTRY_PASSWORD',
usernameVariable: 'REGISTRY_USER')]) {
sh "echo $REGISTRY_PASSWORD | docker login --username $REGISTRY_USER --password-stdin $REGISTRY_NAME"
}
sh "docker push ${REGISTRY_NAME}/${IMAGE_PROJECT}/${IMAGE_NAME}:${IMAGE_TAG}"
sh "docker push ${REGISTRY_NAME}/${IMAGE_PROJECT}/ruoyi-nginx:${IMAGE_TAG}"
}
}
stage('deploy') {
steps {
sh """
docker run -d -p 38080:8080 -u root \
--network my-network \
-e TZ="Asia/Shanghai" \
--name ${IMAGE_NAME} ${REGISTRY_NAME}/${IMAGE_PROJECT}/${IMAGE_NAME}:${IMAGE_TAG}
docker run -d -p 38081:80 -u root \
--network my-network \
-e TZ="Asia/Shanghai" \
--name ruoyi-nginx ${REGISTRY_NAME}/${IMAGE_PROJECT}/ruoyi-nginx:${IMAGE_TAG}
"""
}
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/banh/ruoyi-test.git
[email protected]:banh/ruoyi-test.git
banh
ruoyi-test
ruoyi-test
master

搜索帮助