From 1063ca66c35aae563982acec842627c5797bb352 Mon Sep 17 00:00:00 2001 From: liuchen <23082234@qq.com> Date: Tue, 6 Feb 2024 08:58:03 +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 --- .env.production | 6 ++--- .env.test | 10 ++++---- Dockerfile | 7 ++++++ nginx.conf | 61 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 76 insertions(+), 8 deletions(-) create mode 100644 Dockerfile create mode 100644 nginx.conf diff --git a/.env.production b/.env.production index e439126..3baf54e 100644 --- a/.env.production +++ b/.env.production @@ -28,10 +28,10 @@ VITE_SOURCEMAP=false VITE_BASE_PATH=/ # 输出路径 -VITE_OUT_DIR=dist-test +VITE_OUT_DIR=eam # 自定义接口路径 -VITE_INTERFACE_URL='http://dev.ccwin-in.com:25110/magic/web/index.html' +VITE_INTERFACE_URL='http://10.62.193.15:25110/magic/web/index.html' # 积木报表请求路径 -VITE_JMREPORT_BASE_URL='http://dev.ccwin-in.com:25110' +VITE_JMREPORT_BASE_URL='http://10.62.193.15:25110' diff --git a/.env.test b/.env.test index 84edcdf..f8d316c 100644 --- a/.env.test +++ b/.env.test @@ -4,10 +4,10 @@ NODE_ENV=test VITE_DEV=false # 请求路径 -VITE_BASE_URL='http://dev.ccwin-in.com:25100/api' +VITE_BASE_URL='http://dev.ccwin-in.com:25200/api' # 上传路径 -VITE_UPLOAD_URL='http://dev.ccwin-in.com:25100/api/admin-api/infra/file/upload' +VITE_UPLOAD_URL='http://dev.ccwin-in.com:25200/api/admin-api/infra/file/upload' # 接口前缀 VITE_API_BASEPATH= @@ -28,10 +28,10 @@ VITE_SOURCEMAP=false VITE_BASE_PATH=/ # 输出路径 -VITE_OUT_DIR=dist-test +VITE_OUT_DIR=eam # 自定义接口路径 -VITE_INTERFACE_URL='http://dev.ccwin-in.com:25110/magic/web/index.html' +VITE_INTERFACE_URL='http://dev.ccwin-in.com:25210/magic/web/index.html' # 积木报表请求路径 -VITE_JMREPORT_BASE_URL='http://dev.ccwin-in.com:25110' +VITE_JMREPORT_BASE_URL='http://dev.ccwin-in.com:25210' diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ed98c22 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +# 设置基础镜像 +FROM nginx:WIN-1.25.3 + +WORKDIR /opt/eam +COPY nginx.conf /usr/local/nginx/conf/nginx.conf +# 将dist文件中的内容复制到 /opt/eam 这个目录下面 +COPY eam/ /opt/eam diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..1e179e1 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,61 @@ +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 25200; + 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 /profile/ { + proxy_cache my_zone; + proxy_cache_valid 200 304 12h; + proxy_cache_key $host$uri$is_args$args; + alias /opt/profile/; + index index.html index.htm; + } + 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; + index index.html index.htm; + } + } +} +