Compare commits

...

3 Commits
main ... master

Author SHA1 Message Date
suguo.yao 3125a1e994 chore: 部署位置变更为/mobile 2025-02-24 23:04:35 +08:00
suguo.yao bdc282c0bf fix: 部署目录调整 2025-02-24 22:19:20 +08:00
suguo.yao 3640a652bf chore: update packages 2025-02-24 22:16:10 +08:00
5 changed files with 40 additions and 11 deletions

2
.env
View File

@ -1,4 +1,4 @@
VITE_APP_PUBLIC_PATH=/
VITE_APP_PUBLIC_PATH=/mobile/
VITE_APP_PREVIEW=true
VITE_APP_API_BASE_URL=/api
VITE_APP_OUT_DIR=dist

View File

@ -1,17 +1,21 @@
FROM nginx:1.25.3-alpine
LABEL "authors"="suguo.yao"
LABEL "email"="ysg@myschools.me"
LABEL authors="suguo.yao"
LABEL email="ysg@myschools.me"
ENV TZ=Asia/Shanghai \
LANG=C.UTF-8 \
APP_DIR=/usr/share/nginx/html
LANG=C.UTF-8 \
APP_DIR=/usr/share/nginx/html
COPY dist/. ${APP_DIR}
# 创建目标目录并复制构建产物
RUN mkdir -p ${APP_DIR}/mobile
COPY dist/. ${APP_DIR}/mobile/
WORKDIR ${APP_DIR}
# 用自定义Nginx配置覆盖默认配置
COPY nginx.conf /etc/nginx/conf.d/default.conf
# 设置时区
RUN ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime \
&& echo ${TZ} > /etc/timezone
EXPOSE 80
RUN ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime \
&& echo ${TZ} > /etc/timezone

24
nginx.conf Normal file
View File

@ -0,0 +1,24 @@
server {
listen 80;
server_name localhost;
location /mobile {
# 关键配置:指向构建产物的物理路径
alias /usr/share/nginx/html/mobile;
# 处理Vue路由的HTML5 History模式
try_files $uri $uri/ /mobile/index.html;
# 确保正确识别文件类型
types {
text/html html;
application/javascript js;
text/css css;
}
}
# 可选:重定向根路径到/mobile按需启用
# location = / {
# return 301 /mobile;
# }
}

View File

@ -2,7 +2,7 @@
"name": "vue3-vant-mobile",
"type": "module",
"version": "3.6.0",
"packageManager": "pnpm@9.15.4",
"packageManager": "pnpm@9.1.4",
"description": "An mobile web apps template based on the Vue 3 ecosystem",
"license": "MIT",
"scripts": {

View File

@ -2,6 +2,7 @@
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
// biome-ignore lint: disable
export {}
/* prettier-ignore */