新增atyou部署脚本
This commit is contained in:
parent
2fa1e60dc4
commit
0ffee518dc
19
.env.prod-atyou
Normal file
19
.env.prod-atyou
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
ENV = 'development'
|
||||||
|
|
||||||
|
VUE_APP_BASE_API = '/console'
|
||||||
|
|
||||||
|
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
||||||
|
|
||||||
|
# application base url
|
||||||
|
VUE_APP_BASE_URL ='https://console.atuchat.com/api'
|
||||||
|
|
||||||
|
# oss
|
||||||
|
VUE_APP_OSS_BUCKET = 'tkm-likei'
|
||||||
|
VUE_APP_OSS_URL = 'https://tkm-likei.oss-ap-southeast-1.aliyuncs.com'
|
||||||
|
|
||||||
|
# h5
|
||||||
|
VUE_APP_H5_BASE_URL = 'https://h5.likeichat.com'
|
||||||
|
|
||||||
|
# start mock
|
||||||
|
VUE_APP_START_MOCK = false
|
||||||
|
|
||||||
6
Dockerfile-atu
Normal file
6
Dockerfile-atu
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
FROM registry.cn-hangzhou.aliyuncs.com/public_mirror_images/nginx:1.26.2
|
||||||
|
COPY dist/ /usr/share/nginx/html/
|
||||||
|
COPY nginx/nginx.conf /etc/nginx/nginx.conf
|
||||||
|
COPY nginx/default-atu.conf /etc/nginx/conf.d/default.conf
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
34
nginx/default-atu.conf
Normal file
34
nginx/default-atu.conf
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
listen [::]:80;
|
||||||
|
server_name _;
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
|
||||||
|
# Load configuration files for the default server block.
|
||||||
|
include /etc/nginx/default.d/*.conf;
|
||||||
|
location / {
|
||||||
|
# 此处的 @router 实际上是引用下面的转发,否则在 Vue 路由刷新时可能会抛出 404
|
||||||
|
try_files $uri $uri/ @router;
|
||||||
|
# 请求指向的首页
|
||||||
|
index index.html;
|
||||||
|
}
|
||||||
|
location /console {
|
||||||
|
proxy_pass http://console.prod.svc.cluster.local/console;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_connect_timeout 30s;
|
||||||
|
proxy_read_timeout 60s;
|
||||||
|
proxy_send_timeout 30s;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "Upgrade";
|
||||||
|
}
|
||||||
|
error_page 404 /404.html;
|
||||||
|
location = /404.html {
|
||||||
|
}
|
||||||
|
|
||||||
|
error_page 500 502 503 504 /50x.html;
|
||||||
|
location = /50x.html {
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -8,6 +8,7 @@
|
|||||||
"dev": "vue-cli-service serve",
|
"dev": "vue-cli-service serve",
|
||||||
"build:dev": "vue-cli-service build --mode development",
|
"build:dev": "vue-cli-service build --mode development",
|
||||||
"build:prod": "vue-cli-service build",
|
"build:prod": "vue-cli-service build",
|
||||||
|
"build:atu-prod": "vue-cli-service build --mode prod-atyou",
|
||||||
"build:stage": "vue-cli-service build --mode staging",
|
"build:stage": "vue-cli-service build --mode staging",
|
||||||
"preview": "node build/index.js --preview",
|
"preview": "node build/index.js --preview",
|
||||||
"lint": "eslint --ext .js,.vue src",
|
"lint": "eslint --ext .js,.vue src",
|
||||||
|
|||||||
66
pipeline-atyou
Normal file
66
pipeline-atyou
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
pipeline {
|
||||||
|
|
||||||
|
agent {
|
||||||
|
label "dev"
|
||||||
|
}
|
||||||
|
|
||||||
|
tools {
|
||||||
|
nodejs 'node14'
|
||||||
|
}
|
||||||
|
|
||||||
|
environment {
|
||||||
|
PATH = "/var/jenkins_home/docker-cli/bin:/var/jenkins_home/kubectl/bin:${env.PATH}"
|
||||||
|
BUILD_IMAGE = "${sh(script:'echo -n likei-dev:page-console-$(date +%Y%m%dv%H%M%S)', returnStdout: true)}"
|
||||||
|
ALIYUN_REGISTRY = "tuokemi-con-registry.ap-southeast-1.cr.aliyuncs.com/atyou-prod/page-console"
|
||||||
|
IMAGE_REP_TAG = ""
|
||||||
|
K8S_NAMESPACE = "prod"
|
||||||
|
K8S_DEPLOYMENT = "console-page"
|
||||||
|
K8S_APP_LABEL = "console-page"
|
||||||
|
DOCKER_FILE = "Dockerfile-atu"
|
||||||
|
}
|
||||||
|
|
||||||
|
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}:page-console-${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