Эх сурвалжийг харах

docs(components): build file

wuheng 1 жил өмнө
parent
commit
6f61e5cd90
5 өөрчлөгдсөн 61 нэмэгдсэн , 1 устгасан
  1. 1 1
      .vscode/settings.json
  2. 5 0
      Dockerfile
  3. 29 0
      Jenkinsfile
  4. 15 0
      default.conf
  5. 11 0
      docker-compose.yaml

+ 1 - 1
.vscode/settings.json

@@ -43,7 +43,7 @@
   "terminal.integrated.fontWeight": 500,
   "terminal.integrated.tabs.enabled": true,
   "workbench.iconTheme": "material-icon-theme",
-  "workbench.colorTheme": "One Dark Pro",
+  "workbench.colorTheme": "Default Light Modern",
   "[html]": {
     "editor.defaultFormatter": "esbenp.prettier-vscode"
   },

+ 5 - 0
Dockerfile

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

+ 29 - 0
Jenkinsfile

@@ -0,0 +1,29 @@
+pipeline {
+    agent any
+    environment {
+        BRANCH_NAME="${env.BRANCH_NAME}".toLowerCase()
+    }
+    stages {
+        stage('Build') {
+            steps {
+                sh 'docker-compose down'
+                nodejs('16.19.0') {
+                    sh 'npm install --registry https://registry.npm.taobao.org'
+                    sh 'npm run build:dev'
+                }
+                sh 'docker build -t ${BRANCH_NAME}:${BUILD_NUMBER} .'
+            }
+        }
+        stage('Test') {
+            steps {
+                echo 'Testing..'
+            }
+        }
+        stage('Deploy') {
+            steps {
+                echo 'Deploying....'
+                sh 'docker-compose up -d'
+            }
+        }
+    }
+}

+ 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 /api/ {
+        proxy_pass http://192.168.18.13:8182/;
+    }
+
+}

+ 11 - 0
docker-compose.yaml

@@ -0,0 +1,11 @@
+version: "3"
+services:
+  post-project-ui:
+    image: ${BRANCH_NAME}:${BUILD_NUMBER}
+    ports:
+      - 9682:80
+    networks:
+      - local_public
+networks:
+  local_public:
+    external: true