From f8dbdb195899ae22555e8d9c54a5b36a830cf4a7 Mon Sep 17 00:00:00 2001 From: zhaoxiaolin Date: Wed, 20 Sep 2023 13:59:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- default.conf | 23 ++++++++++++++--------- push-op-ui.bat | 27 --------------------------- 3 files changed, 15 insertions(+), 37 deletions(-) delete mode 100644 push-op-ui.bat diff --git a/Dockerfile b/Dockerfile index cb95efc..6dbf2b1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,3 @@ -FROM 192.168.3.157:8001/library/nginx:1.20-alpine +FROM nginx:1.20-alpine COPY default.conf /etc/nginx/conf.d/default.conf ADD dist /usr/share/nginx/html diff --git a/default.conf b/default.conf index 4e317c7..01c26af 100644 --- a/default.conf +++ b/default.conf @@ -1,21 +1,26 @@ server { - listen 80; + listen 9000; server_name localhost; default_type 'text/html'; charset utf-8; - - location @fallback{ - rewrite .* /index.html break; - } - + location / { - root /usr/share/nginx/html; + root /usr/share/nginx/html; + try_files $uri $uri/ /index.html; index index.html index.htm; - try_files $uri /index.html; } - + + location /prod-api/ { + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header REMOTE-HOST $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_pass http://192.168.202.20:8080/; + } + error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } + } diff --git a/push-op-ui.bat b/push-op-ui.bat deleted file mode 100644 index 423df71..0000000 --- a/push-op-ui.bat +++ /dev/null @@ -1,27 +0,0 @@ -@echo off -echo --------------------------------自定义参数,启动前先修改-------------------------------------- -set imageURI=140.249.53.142:30002/open-platform/op-ui -::echo 获取当前日期字符串 -for /f "tokens=1,2,3 delims=/- " %%a in ("%date%") do @set D=%%a%%b%%c -::echo 获取当前时间字符串 -for /f "tokens=1,2 delims=:." %%a in ("%time%") do @set T=%%a%%b -::echo 如当前小时小于10,将空格替换为0 -set T=%T: =0% -::echo 显示输出日期时间字符串 -set imageVersion=%D%%T% -::输出发版信息 -echo 镜像库地址:%imageURI% -echo 镜像版本:%imageVersion% -echo --------------------------------执行打包-------------------------------- -call npm run build:prod - -dir -echo --------------------------------docker login...------------------------------- -docker login 140.249.53.142:30002 -u deploy -p Deploy@2023 -echo --------------------------------docker build...------------------------------- -docker build -t %imageURI%:%imageVersion% . -echo --------------------------------docker push...-------------------------------- -docker push %imageURI%:%imageVersion% -@pause - -::docker pull 192.168.3.157:8001/library/nginx:1.20-alpine \ No newline at end of file