浏览代码

Merge branch 'HitSheep' of http://39.105.160.25:10880/post-project-ui/post-ui into HitSheep

zhangxin 2 年之前
父节点
当前提交
cf6f6498ec
共有 6 个文件被更改,包括 53 次插入18 次删除
  1. 3 1
      Dockerfile
  2. 9 10
      Jenkinsfile
  3. 19 4
      babel.config.js
  4. 15 0
      default.conf
  5. 2 3
      docker-compose.yml
  6. 5 0
      package.json

+ 3 - 1
Dockerfile

@@ -1,3 +1,5 @@
 FROM nginx
 EXPOSE 80
-COPY dist /usr/share/nginx/html
+RUN rm -v /etc/nginx/conf.d/default.conf
+ADD default.conf /etc/nginx/conf.d/
+COPY ./dist /usr/share/nginx/html

+ 9 - 10
Jenkinsfile

@@ -1,17 +1,17 @@
 pipeline {
     agent any
+    environment {
+        BRANCH_NAME="${env.BRANCH_NAME}".toLowerCase()
+    }
     stages {
         stage('Build') {
-            agent {
-                docker {
-                    image 'node:16-alpine'  
-                }
-            }
             steps {
-                sh 'docker-compose stop'
-                sh 'docker-compose rm -sf'
-                sh 'npm install --registry https://registry.npm.taobao.org'
-                sh 'npm run build:prod'
+                sh 'docker-compose down'
+                nodejs('16.19.0') {
+                    sh 'npm install --registry https://registry.npm.taobao.org'
+                    sh 'npm run build:prod'
+                }
+                sh 'docker build -t ${BRANCH_NAME}:${BUILD_NUMBER} .'
             }
         }
         stage('Test') {
@@ -22,7 +22,6 @@ pipeline {
         stage('Deploy') {
             steps {
                 echo 'Deploying....'
-                sh 'docker build -t hitsheep:0.1 .'
                 sh 'docker-compose up -d'
             }
         }

+ 19 - 4
babel.config.js

@@ -1,7 +1,21 @@
 module.exports = {
-  presets: [
-    // https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app
-    '@vue/cli-plugin-babel/preset'
+  "presets": [
+    '@vue/cli-plugin-babel/preset',
+    [
+      "@babel/preset-env",
+      {
+        "useBuiltIns": "usage",
+        "corejs": 3
+      }
+    ]
+  ],
+  "plugins": [
+    ["component",
+      {
+        "libraryName": "element-ui",
+        "styleLibraryName": "theme-chalk"
+      }
+    ]
   ],
   'env': {
     'development': {
@@ -10,4 +24,5 @@ module.exports = {
       'plugins': ['dynamic-import-node']
     }
   }
-}
+}
+

+ 15 - 0
default.conf

@@ -0,0 +1,15 @@
+server {
+    #red
+    listen       80;
+    server_name  localhost;
+
+    location / {
+        root   /usr/share/nginx/html;
+        index  index.html index.htm;
+    }
+    
+    location /prod-api/ {           
+        proxy_pass http://red-post-project-api-1:8080/;
+    }
+    
+}

+ 2 - 3
docker-compose.yml

@@ -1,7 +1,6 @@
 services:
-  post-project-ui-HitSheep:
-    image: hitsheep:0.1
-    container_name: post-ui-HitSheep
+  post-project-ui:
+    image: ${BRANCH_NAME}:${BUILD_NUMBER}
     ports:
       - 8680:80
     networks:

+ 5 - 0
package.json

@@ -37,6 +37,7 @@
   },
   "dependencies": {
     "@riophae/vue-treeselect": "0.4.0",
+    "async-validator": "^1.11.5",
     "axios": "0.24.0",
     "clipboard": "2.0.8",
     "core-js": "3.25.3",
@@ -64,10 +65,14 @@
     "vuex": "3.6.0"
   },
   "devDependencies": {
+    "@babel/plugin-transform-runtime": "^7.17.10",
+    "@babel/runtime-corejs3": "^7.17.9",
     "@vue/cli-plugin-babel": "4.4.6",
     "@vue/cli-plugin-eslint": "4.4.6",
     "@vue/cli-service": "4.4.6",
+    "babel-plugin-import": "^1.13.5",
     "babel-eslint": "10.1.0",
+    "babel-plugin-component": "^1.1.1",
     "babel-plugin-dynamic-import-node": "2.3.3",
     "chalk": "4.1.0",
     "compression-webpack-plugin": "5.0.2",