From 028638433f5eeb0aa95cb572376d51aa1b8eaf64 Mon Sep 17 00:00:00 2001 From: liuchen864 <23082234@qq.com> Date: Wed, 6 Mar 2024 12:57:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0dockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 7 +++++++ nginx.conf | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 10 +++------- src/config.js | 7 +++---- 4 files changed, 66 insertions(+), 11 deletions(-) create mode 100644 Dockerfile create mode 100644 nginx.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..debf35f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +# 设置基础镜像 +FROM nginx:WIN-1.25.3 + +WORKDIR /opt/eam-pda +COPY nginx.conf /usr/local/nginx/conf/nginx.conf +# 将dist/build/h5/文件中的内容复制到 /opt/eam-pda 这个目录下面 +COPY dist/build/h5/ /opt/eam-pda diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..736b346 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,53 @@ +user root; +worker_processes 2; + +events { + worker_connections 1024; +} + +http { + include mime.types; + charset utf-8,gbk; + default_type application/octet-stream; + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for" "$request_time $upstream_response_time"'; + + proxy_cache_path /opt/nginx_cache/ levels=1:2 keys_zone=my_zone:10m inactive=300s max_size=5g; + access_log logs/access.log main; + sendfile on; + #tcp_nopush on; + keepalive_timeout 600s; + client_max_body_size 200m; + gzip on; + gzip_min_length 10k; + gzip_comp_level 9; + gzip_buffers 4 16k; + gzip_types text/plain application/javascript text/css application/xml text/javascript image/jpeg image/gif image/png; + gzip_vary on; + gzip_disable "MSIE [1-6]\."; + upstream eam { + server localhost:25210 weight=10 max_fails=3 fail_timeout=10s; + } + server { + listen 25203; + server_name_in_redirect off; + server_name dev.ccwin-in.com; + location /api/ { + proxy_pass http://eam/; + proxy_next_upstream http_500 http_502 http_503 http_504 error timeout invalid_header; + proxy_set_header X-Forwared-For $proxy_add_x_forwarded_for; + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $http_x_forwarded_for; + } + location / { + proxy_cache my_zone; + proxy_cache_valid 200 304 12h; + proxy_cache_key $host$uri$is_args$args; + try_files $uri $uri/ /index.html; + root /opt/eam-pda; + index index.html index.htm; + } + } +} \ No newline at end of file diff --git a/package.json b/package.json index cf6f0f6..6960af0 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,8 @@ "version": "0.1.0", "private": true, "scripts": { - "serve": "npm run dev:h5", - "build": "npm run build:h5", + "dev": "npm run dev:h5", + "test": "npm run build:h5", "build:app-plus": "cross-env NODE_ENV=production UNI_PLATFORM=app-plus vue-cli-service uni-build", "build:custom": "cross-env NODE_ENV=production uniapp-cli custom", "build:h5": "cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service uni-build", @@ -13,11 +13,7 @@ "dev:custom": "cross-env NODE_ENV=development uniapp-cli custom", "dev:h5": "cross-env NODE_ENV=development UNI_PLATFORM=h5 vue-cli-service uni-serve", "dev:mp-weixin": "cross-env NODE_ENV=development UNI_PLATFORM=mp-weixin vue-cli-service uni-build --watch", - "info": "node node_modules/@dcloudio/vue-cli-plugin-uni/commands/info.js", - "test:android": "cross-env UNI_PLATFORM=app-plus UNI_OS_NAME=android jest -i", - "test:h5": "cross-env UNI_PLATFORM=h5 jest -i", - "test:ios": "cross-env UNI_PLATFORM=app-plus UNI_OS_NAME=ios jest -i", - "test:mp-weixin": "cross-env UNI_PLATFORM=mp-weixin jest -i" + "info": "node node_modules/@dcloudio/vue-cli-plugin-uni/commands/info.js" }, "dependencies": { "@dcloudio/uni-app": "^2.0.2-3090920231225001", diff --git a/src/config.js b/src/config.js index df0ed6d..36476dc 100644 --- a/src/config.js +++ b/src/config.js @@ -1,7 +1,7 @@ // 应用全局配置 module.exports = { - baseUrl: process.env.NODE_ENV === 'development' ? 'http://192.168.0.172:12080' : 'http://dev.ccwin-in.com:25210', - baseApi:process.env.NODE_ENV === 'development' ? '/admin-api' : '/admin-api', + baseUrl: process.env.NODE_ENV === 'development' ? 'http://192.168.0.172:12080' : 'http://dev.ccwin-in.com:25203', + baseApi:process.env.NODE_ENV === 'development' ? '/admin-api' : '/api/admin-api', // 应用信息 appInfo: { // 应用名称 @@ -16,8 +16,7 @@ module.exports = { agreements: [{ title: "隐私政策", url: "https://iocoder.cn" - }, - { + }, { title: "用户服务协议", url: "https://iocoder.cn" }