新增 atyou正式环境
This commit is contained in:
parent
471d989589
commit
0a91f97edc
4
.env.production-atu
Normal file
4
.env.production-atu
Normal file
@ -0,0 +1,4 @@
|
||||
# 生产环境
|
||||
VITE_NODE_ENV=production
|
||||
VITE_API_BASE_URL=https://api.atuchat.com
|
||||
VITE_APP_TITLE=@U H5
|
||||
@ -14,6 +14,7 @@
|
||||
"build:dev": "vite build --mode development && node scripts/generate-version.js",
|
||||
"build:test": "vite build --mode test && node scripts/generate-version.js",
|
||||
"build:prod": "vite build --mode production && node scripts/generate-version.js",
|
||||
"build:atu-prod": "vite build --mode production-atu && node scripts/generate-version.js",
|
||||
"preview": "vite preview",
|
||||
"lint": "eslint . --fix"
|
||||
},
|
||||
|
||||
66
pipeline-atu
Normal file
66
pipeline-atu
Normal file
@ -0,0 +1,66 @@
|
||||
pipeline {
|
||||
|
||||
agent {
|
||||
label "dev"
|
||||
}
|
||||
|
||||
tools {
|
||||
nodejs 'node22'
|
||||
}
|
||||
|
||||
environment {
|
||||
PATH = "/var/jenkins_home/docker-cli/bin:/var/jenkins_home/kubectl/bin:${env.PATH}"
|
||||
BUILD_IMAGE = "${sh(script:'echo -n atyou-prod:h5-$(date +%Y%m%dv%H%M%S)', returnStdout: true)}"
|
||||
ALIYUN_REGISTRY = "tuokemi-con-registry.ap-southeast-1.cr.aliyuncs.com/atyou-prod/h5"
|
||||
IMAGE_REP_TAG = ""
|
||||
K8S_NAMESPACE = "prod"
|
||||
K8S_DEPLOYMENT = "h5"
|
||||
K8S_APP_LABEL = "h5"
|
||||
DOCKER_FILE = "Dockerfile-dev"
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Build') {
|
||||
steps {
|
||||
sh 'export PATH=$HOME/bin:$PATH && export NODE_HOME=/usr/local/node && export PATH=$NODE_HOME/bin:$PATH && npm config set registry https://registry.npmmirror.com && npm install'
|
||||
sh 'export PATH=$HOME/bin:$PATH && export NODE_HOME=/usr/local/node && export PATH=$NODE_HOME/bin:$PATH && npm run build:atu-prod'
|
||||
sh 'du -sh dist'
|
||||
script {
|
||||
IMAGE_REP_TAG = "${ALIYUN_REGISTRY}:h5-${sh(script:'date +%Y%m%dv%H%M%S', returnStdout: true).trim()}"
|
||||
}
|
||||
echo "---> Image registry tag: ${IMAGE_REP_TAG}"
|
||||
}
|
||||
}
|
||||
stage('Build image') {
|
||||
steps {
|
||||
withCredentials([usernamePassword(
|
||||
credentialsId: 'aliyun-registry',
|
||||
usernameVariable: 'ALIYUN_USER',
|
||||
passwordVariable: 'ALIYUN_PASS'
|
||||
)]) {
|
||||
sh 'echo $ALIYUN_PASS | docker login --username $ALIYUN_USER --password-stdin tuokemi-con-registry.ap-southeast-1.cr.aliyuncs.com'
|
||||
}
|
||||
sh "docker build -f ${DOCKER_FILE} -t ${IMAGE_REP_TAG} ."
|
||||
}
|
||||
}
|
||||
stage('Upload image') {
|
||||
steps {
|
||||
sh "docker push ${IMAGE_REP_TAG}"
|
||||
sh "docker tag ${IMAGE_REP_TAG} ${ALIYUN_REGISTRY}:latest"
|
||||
sh "docker push ${ALIYUN_REGISTRY}:latest"
|
||||
sh "docker rmi -f ${IMAGE_REP_TAG} ${ALIYUN_REGISTRY}:latest"
|
||||
}
|
||||
}
|
||||
stage('Apply') {
|
||||
steps {
|
||||
sh "kubectl -n ${K8S_NAMESPACE} set image deployment/${K8S_DEPLOYMENT} ${K8S_APP_LABEL}=${IMAGE_REP_TAG.replace('tuokemi-con-registry', 'tuokemi-con-registry-vpc')}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
always {
|
||||
cleanWs()
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user