Commit b28ceee9 authored by 张伯涛's avatar 张伯涛

修改发版配置文件

parent 08854bc7
......@@ -21,7 +21,7 @@ ENV = 'production'
# 生产环境
# base api
VUE_APP_BASE_API = 'http://zt.cebitic.com:10184'
VUE_APP_BASE_API = 'http://117.122.212.91:32032'
# workFlow链接地址
VUE_APP_WORKFLOW = 'http://zt.cebitic.com:10184/workFlow'
# internal链接地址
......
pipeline {
agent {
node {
label 'nodejs16'
}
}
parameters{
string(name:'TAG_NAME',defaultValue: '1.0',description:'')
choice(description: '你需要选择哪个环境进行构建?',name: 'ENVIRONMENT',choices: ['dev', 'test'])
}
environment {
DOCKER_CREDENTIAL_ID = '91isoft-harbor'
GITLAB_CREDENTIAL_ID = '91isoft-gitlab'
KUBECONFIG_CREDENTIAL_ID = '91isoft-kube'
REGISTRY = 'harbor.91isoft.com:100'
HARBOR_NAMESPACE = 'cy'
GITLAB_ACCOUNT = 'licongyang@91isoft.com'
APP_NAME = '91isoft-v3-monitor-web'
GIT_LAB_PROJECT = 'http://gitlab.91isoft.com:90/zhangbotao/it-monitor.git '
}
stages {
stage('checkout scm') {
steps {
checkout(scm)
}
}
stage('get dependencies') {
steps {
container('nodejs16') {
sh 'rm -rf node_modules'
sh 'node -v'
sh 'npm -v'
sh 'yarn -v'
sh 'yarn install'
}
}
}
stage('build') {
steps {
container('nodejs16') {
sh 'yarn run build:$ENVIRONMENT'
}
}
}
stage('push') {
steps {
container('nodejs16') {
sh 'cp `pwd`/deploy/$ENVIRONMENT/Dockerfile `pwd`/configuration/'
sh 'rm -rf dist/dist.tar.gz'
sh 'cd dist && tar -zcvf dist.tar.gz *'
sh 'echo `pwd`'
sh 'cd ../'
sh 'cat `pwd`/configuration/Dockerfile'
sh 'docker build --no-cache -f `pwd`/configuration/Dockerfile -t $REGISTRY/$HARBOR_NAMESPACE/$APP_NAME:latest .'
withCredentials([usernamePassword(passwordVariable : 'DOCKER_PASSWORD' ,usernameVariable : 'DOCKER_USERNAME' ,credentialsId : "$DOCKER_CREDENTIAL_ID")]) {
sh 'echo "$DOCKER_PASSWORD" | docker login $REGISTRY -u "$DOCKER_USERNAME" --password-stdin'
sh 'docker push $REGISTRY/$HARBOR_NAMESPACE/$APP_NAME:latest'
}
}
}
}
//deploy
stage('deploy') {
steps {
//input(id: 'deploy-to-test', message: 'deploy to test?')
kubernetesDeploy(configs: "deploy/$ENVIRONMENT/**.yaml", enableConfigSubstitution: true, kubeconfigId: "$KUBECONFIG_CREDENTIAL_ID")
}
}
stage('push with tag'){
when{
expression{
return params.TAG_NAME =~ /v.*/
}
}
steps {
input(id: 'release-image-with-tag', message: 'release image with tag?')
withCredentials([usernamePassword(credentialsId: "$GITLAB_CREDENTIAL_ID", passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
sh 'git config --global user.email "licongyang@91isoft.com" '
sh 'git config --global user.name "cy" '
sh 'git tag -a $TAG_NAME -m "$TAG_NAME" '
sh 'git push $GIT_LAB_PROJECT --tags --ipv4'
}
sh 'docker tag $REGISTRY/$HARBOR_NAMESPACE/$APP_NAME:latest $REGISTRY/$HARBOR_NAMESPACE/$APP_NAME:$TAG_NAME '
sh 'docker push $REGISTRY/$HARBOR_NAMESPACE/$APP_NAME:$TAG_NAME '
}
}
}
}
FROM nginx
MAINTAINER cy "licongyang@91isoft.com"
ENV LANG C.UTF-8
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN mkdir -p /usr/share/nginx/html/
ADD dist/dist.tar.gz /usr/share/nginx/html/
EXPOSE 80
ENTRYPOINT nginx -g "daemon off;"
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: rcisoft-monitor
component: rcisoft-monitor
tier: front
name: rcisoft-v2-monitor-deploy
namespace: rcisoft-v2
spec:
progressDeadlineSeconds: 600
replicas: 1
selector:
matchLabels:
app: rcisoft-monitor
component: rcisoft-monitor
tier: front
template:
metadata:
labels:
app: rcisoft-monitor
component: rcisoft-monitor
tier: front
spec:
volumes:
- name: date-config
hostPath:
path: /etc/localtime
type: File
- name: nginx-config
configMap:
name: nginx-conf
items:
- key: nginx-process.conf
path: etc/nginx/nginx.conf
defaultMode: 420
containers:
- env:
- name: TZ
value: Asia/Shanghai
- name: build-number
value: $BUILD_NUMBER
image: $REGISTRY/$HARBOR_NAMESPACE/$APP_NAME:latest
#先屏蔽健康检查
#readinessProbe:
# httpGet:
# path: /
# port: 8080
# timeoutSeconds: 10
# failureThreshold: 30
# periodSeconds: 5
name: rcisoft-v2-monitor
imagePullPolicy: Always
ports:
- containerPort: 8080
protocol: TCP
resources:
limits:
cpu: 400m
memory: 500Mi
requests:
cpu: 200m
memory: 256Mi
volumeMounts:
- name: date-config
readOnly: true
mountPath: /etc/localtime
- name: nginx-config
mountPath: /etc/nginx/nginx.conf
subPath: etc/nginx/nginx.conf
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
terminationGracePeriodSeconds: 30
imagePullSecrets:
- name: 91isoft-harbor
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
---
kind: Service
apiVersion: v1
metadata:
name: rcisoft-v2-monitor-svc
namespace: rcisoft-v2
labels:
app: rcisoft-monitor
spec:
ports:
- name: tcp-80
protocol: TCP
port: 80
targetPort: 80
nodePort: 30306
selector:
app: rcisoft-monitor
component: rcisoft-monitor
tier: front
type: NodePort
......@@ -7,6 +7,7 @@
"scripts": {
"dev": "vue-cli-service serve",
"build:prod": "vue-cli-service build",
"build:dev": "vue-cli-service build",
"build:stage": "vue-cli-service build --mode staging",
"build:test": "vue-cli-service build --mode test",
"preview": "node build/index.js --preview",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment