From 119d219a8d87462c152e783eeac9c891cdf7dc39 Mon Sep 17 00:00:00 2001 From: Bunny <1319900154@qq.com> Date: Sat, 11 May 2024 23:20:55 +0800 Subject: [PATCH 1/2] =?UTF-8?q?chore:=20=F0=9F=94=A8=20=E6=B7=BB=E5=8A=A0d?= =?UTF-8?q?ocker=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 5 +++++ docker/dockerfile | 23 +++++++++++++++++++++++ docker/nginx.conf | 27 +++++++++++++++++++++++++++ uno.config.ts | 2 +- 4 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 .vscode/settings.json create mode 100644 docker/dockerfile create mode 100644 docker/nginx.conf diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..75b9882 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "i18n-ally.localesPaths": [ + "src/languages" + ] +} \ No newline at end of file diff --git a/docker/dockerfile b/docker/dockerfile new file mode 100644 index 0000000..7e130ef --- /dev/null +++ b/docker/dockerfile @@ -0,0 +1,23 @@ +# 使用官方的 Nginx 镜像作为基础镜像 +FROM nginx + +# 删除默认的 Nginx 配置文件 +RUN rm /etc/nginx/conf.d/default.conf + +# 将自定义的 Nginx 配置文件复制到容器中 +COPY nginx.conf /etc/nginx/conf.d/ + +# 创建一个目录来存放前端项目文件 +WORKDIR /usr/share/nginx/html + +# 将前端项目打包文件复制到 Nginx 的默认静态文件目录 +COPY dist/ /usr/share/nginx/html +# 复制到nginx目录下 +COPY dist/ /etc/nginx/html + +# 暴露 Nginx 的默认端口 +EXPOSE 80 + +# 自动启动 Nginx +CMD ["nginx", "-g", "daemon off;"] + diff --git a/docker/nginx.conf b/docker/nginx.conf new file mode 100644 index 0000000..67110b3 --- /dev/null +++ b/docker/nginx.conf @@ -0,0 +1,27 @@ +server { + listen 80; + listen [::]:80; + server_name localhost; + + location / { + root /etc/nginx/html; + index index.html index.htm; + try_files $uri /index.html; + } + + # 后端跨域请求 + location ~/api/ { + proxy_pass http://192.168.3.98:1001; + } + + # mock 跨域 + location ~/mock/ { + proxy_pass http://192.168.3.98:1001; + } + + error_page 404 404.html; + + location = /50x.html { + root html; + } +} \ No newline at end of file diff --git a/uno.config.ts b/uno.config.ts index 09c3204..953fa19 100644 --- a/uno.config.ts +++ b/uno.config.ts @@ -1,6 +1,6 @@ -import { defineConfig } from "@unocss/vite"; import presetUno from "@unocss/preset-uno"; import transformerDirectives from "@unocss/transformer-directives"; +import { defineConfig } from "@unocss/vite"; export default defineConfig({ content: { From 15b1e92c9272526863a161e80e097245ac6100e5 Mon Sep 17 00:00:00 2001 From: Bunny <1319900154@qq.com> Date: Sat, 11 May 2024 23:28:06 +0800 Subject: [PATCH 2/2] =?UTF-8?q?chore:=20=F0=9F=94=A8=20eslint=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=94=B9=E4=B8=BAmodule?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 7acba63..9f23cbd 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,6 +1,6 @@ // @see: http://eslint.cn -module.exports = { +export default { root: true, env: { browser: true,