Browse Source

Merge branch 'develop' of duanxiaoduan/tmr-group-admin into master

xuyiping 1 year ago
parent
commit
f0e2709f79
3 changed files with 111 additions and 0 deletions
  1. 42 0
      .drone.yml
  2. 15 0
      Dockerfile
  3. 54 0
      default.conf.template

+ 42 - 0
.drone.yml

@@ -0,0 +1,42 @@
+kind: pipeline
+type: docker
+name: tmp-group-admin
+
+steps:
+  - name: build
+    image: plugins/docker
+    volumes:
+      - name: hosts
+        path: /etc/hosts
+      - name: docker-ca
+        path: /etc/docker
+      - name: docker-sock
+        path: /var/run/docker.sock
+    settings:
+      dockerfile: /drone/src/Dockerfile
+      username:
+        from_secret: aliyun_name
+      password:
+        from_secret: aliyun_password
+      repo: registry.cn-hangzhou.aliyuncs.com/kpt-event/tmr-group-admin
+      registry: registry.cn-hangzhou.aliyuncs.com
+      tags: [ 1.0.0,latest ]
+
+trigger:
+  branch:
+    include:
+      - develop
+  event:
+    include:
+      - push
+
+volumes:
+  - name: host
+    host:
+      path: /etc/host
+  - name: docker-ca
+    host:
+      path: /ect/docker
+  - name: docker-sock
+    host:
+      path: /var/run/docker.sock

+ 15 - 0
Dockerfile

@@ -0,0 +1,15 @@
+FROM node:14.0.0 as builder
+WORKDIR /app/tmr-group-admin
+#拷贝源码
+COPY . .
+#安装依赖
+RUN npm install --registry=https://registry.npm.taobao.org
+
+# 开始构建
+RUN npm run build:prod
+
+# 第二阶段构建
+FROM nginx:alpine
+COPY --from=builder /app/tmr-group-admin/dist/ /usr/share/nginx/html/
+COPY --from=builder /app/tmr-group-admin/default.conf.template /etc/nginx/templates/default.conf.template
+EXPOSE 80

+ 54 - 0
default.conf.template

@@ -0,0 +1,54 @@
+server {
+    listen       80;
+    listen  [::]:80;
+    server_name  localhost;
+
+    #access_log  /var/log/nginx/host.access.log  main;
+
+   location / {
+        root /usr/share/nginx/html;
+        #index index.html;
+        try_files $uri $uri/ /index.html;
+   }
+    #error_page  404              /404.html;
+
+    # redirect server error pages to the static page /50x.html
+    #
+    error_page   500 502 503 504  /50x.html;
+    location = /50x.html {
+        root   /usr/share/nginx/html;
+    }
+
+    # location /prod-api/ {
+    #    proxy_pass  ${BACKEND_HOST};
+    #    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_http_version 1.1;
+    #    proxy_set_header Connection "";
+    #}
+
+    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
+    #
+    #location ~ \.php$ {
+    #    proxy_pass   http://127.0.0.1;
+    #}
+
+    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
+    #
+    #location ~ \.php$ {
+    #    root           html;
+    #    fastcgi_pass   127.0.0.1:9000;
+    #    fastcgi_index  index.php;
+    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
+    #    include        fastcgi_params;
+    #}
+
+    # deny access to .htaccess files, if Apache's document root
+    # concurs with nginx's one
+    #
+    #location ~ /\.ht {
+    #    deny  all;
+    #}
+}
+