Browse Source

♻ refactor: docker

chuzhixin 3 years ago
parent
commit
32d6a3d141
11 changed files with 3 additions and 171 deletions
  1. 0 1
      .dockerignore
  2. 0 7
      .eslintignore
  3. 0 37
      Dockerfile
  4. 1 1
      README.md
  5. 0 5
      deploy-docker-compose.sh
  6. 0 7
      deploy-docker.sh
  7. 0 14
      docker-compose.yml
  8. 0 45
      nginx.conf
  9. 0 46
      nginx.default.conf
  10. 2 2
      push.sh
  11. 0 6
      webstorm.config.js

+ 0 - 1
.dockerignore

@@ -1 +0,0 @@
-node_modules

+ 0 - 7
.eslintignore

@@ -1,7 +0,0 @@
-# .eslintignore
-
-src/assets
-src/icons
-public
-dist
-node_modules

+ 0 - 37
Dockerfile

@@ -1,37 +0,0 @@
-FROM nginx
-
-MAINTAINER vue-admin-beautiful
-LABEL description=本项目基于vue-admin-beautiful开源版构建
-LABEL qq=783963206
-
-# 环境变量
-ENV TZ=Asia/Shanghai \
-    RUN_USER=nginx \
-    RUN_GROUP=nginx \
-    DATA_DIR=/data/web \
-    LOG_DIR=/data/log/nginx
-
-# 工作目录
-WORKDIR ${DATA_DIR}
-
-# 日志输出
-RUN ["echo","vue-admin-beautiful - UI building..."]
-
-# 切换为上海时区
-RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime \
-    && echo $TZ > /etc/timezone
-
-# 创建日志文件夹
-RUN mkdir ${LOG_DIR} -p
-RUN chown nginx.nginx -R ${LOG_DIR}
-
-# 拷贝dist包文件
-COPY ./dist ./
-
-# 拷贝nginx配置文件
-ADD nginx.conf /etc/nginx/nginx.conf
-ADD nginx.default.conf /etc/nginx/conf.d/default.conf
-
-EXPOSE 80
-
-ENTRYPOINT nginx -g "daemon off;"

+ 1 - 1
README.md

@@ -214,7 +214,7 @@ npm run serve
 
 ## 📄 商用注意事项
 
-此项目可免费用于商业用途,请遵守 MIT 协议并保留作者技术支持声明,如需自定义源码版权信息请联系客服 QQ 783963206。
+此项目可免费用于商业用途,请遵守 MIT 协议并保留作者技术支持声明,如需自定义源码版权信息请联系邮箱 1204505056@qq.com
 
 <!-- ## 严正声明
 

+ 0 - 5
deploy-docker-compose.sh

@@ -1,5 +0,0 @@
-#!/bin/bash
-
-npm run build
-
-docker-compose up -d

+ 0 - 7
deploy-docker.sh

@@ -1,7 +0,0 @@
-#!/bin/bash
-
-npm run build
-
-docker build -t vue-admin-beautiful .
-
-docker run --name vue-admin-beautiful --restart=always -p 80:80 -v /var/nginx:/var/data -d vue-admin-beautiful

+ 0 - 14
docker-compose.yml

@@ -1,14 +0,0 @@
-version: '3.3'
-services:
-  vue-admin-beautiful:
-    build: ./
-    restart: always
-    container_name: vue-admin-beautiful
-    image: vue-admin-beautiful
-    environment:
-      TZ: Asia/Shanghai
-      LANG: en_US.UTF-8
-    volumes:
-      - /var/nginx:/var/data #挂载 Nginx 文件
-    ports:
-      - "80:80"

+ 0 - 45
nginx.conf

@@ -1,45 +0,0 @@
-user  nginx;
-worker_processes  auto;
-pid        /var/run/nginx.pid;
-
-events {
-    use epoll;
-    worker_connections 51200;
-    multi_accept on;
-}
-
-http {
-    include       /etc/nginx/mime.types;
-    default_type  application/octet-stream;
-
-    server_names_hash_bucket_size 512;
-    client_header_buffer_size 32k;
-    large_client_header_buffers 4 32k;
-    client_max_body_size 50m;
-
-    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
-                      '$status $body_bytes_sent "$http_referer" '
-                      '"$http_user_agent" "$http_x_forwarded_for"';
-    access_log  /var/log/nginx/access.log  main;
-    sendfile        on;
-    tcp_nopush     on;
-    tcp_nodelay on;
-
-    keepalive_timeout  65;
-
-    # gzip 压缩
-    gzip on;
-    gzip_min_length  1k;
-    gzip_buffers     4 16k;
-    gzip_http_version 1.1;
-    gzip_comp_level 2;
-    gzip_types     text/plain application/javascript application/x-javascript text/javascript text/css application/xml;
-    gzip_vary on;
-    gzip_proxied   expired no-cache no-store private auth;
-    gzip_disable   "MSIE [1-6]\.";
-
-    limit_conn_zone $binary_remote_addr zone=perip:10m;
-    limit_conn_zone $server_name zone=perserver:10m;
-
-    include /etc/nginx/conf.d/*.conf;
-}

+ 0 - 46
nginx.default.conf

@@ -1,46 +0,0 @@
-server {
-    listen       80;
-    server_name  localhost;
-
-    access_log  /data/log/nginx/access.log  main;
-    error_log   /data/log/nginx/error.log;
-
-    # 静态资源
-    location / {
-        root   /data/web;
-        index  index.html index.htm;
-        try_files $uri $uri/ /index.html;
-    }
-
-    # 前端代理
-    location ^~ /后端服务名 {
-        proxy_pass http://后端服务IP地址:8080;
-        add_header Access-Control-Allow-Origin *;
-        add_header Access-Control-Allow-Credentials: true;
-        add_header Access-Control-Allow-Methods GET,POST,OPTIONS,PUT,DELETE;
-
-        proxy_http_version 1.1;
-        # 连接延时
-        proxy_connect_timeout 3600s;
-        proxy_read_timeout 3600s;
-        proxy_send_timeout 3600s;
-        # IP 穿透
-        proxy_set_header        Host $proxy_host;
-        proxy_set_header        X-Real-IP $remote_addr;
-        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
-        # WebSocket 穿透
-        proxy_set_header Origin "";
-        proxy_set_header Upgrade $http_upgrade;
-        proxy_set_header Connection "upgrade";
-    }
-
-    # 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;
-    #}
-}
-

+ 2 - 2
push.sh

@@ -3,8 +3,8 @@
 set -e
 git init
 git add -A
-git commit -m '🎉deploy'
-git push -f "https://${access_token}@github.com/chuzhixin/vue-admin-beautiful.git" master
+git commit -m '🎉 feat: init project'
+git push -f "https://${access_token}@github.com/chuzhixin/vue-admin-better.git" master
 exec /bin/bash
 
 

+ 0 - 6
webstorm.config.js

@@ -1,6 +0,0 @@
-/**
- * @author chuzhixin 1204505056@qq.com (不想保留author可删除)
- * @description webstorm.config
- */
-const webpackConfig = require('@vue/cli-service/webpack.config.js')
-module.exports = webpackConfig