feat(docker): 添加docker相关配置和文档

添加Dockerfile、.dockerignore、nginx.conf配置文件
新增docker.md文档说明构建和运行步骤
更新.vscode设置支持docker文件嵌套
This commit is contained in:
feige996
2025-09-17 10:37:59 +08:00
parent e5996b3b93
commit 4e3942eca8
6 changed files with 209 additions and 1 deletions

23
Dockerfile Normal file
View File

@@ -0,0 +1,23 @@
# 前端打包
FROM node:24 AS build
WORKDIR /app
# 安装pnpm
RUN npm install -g pnpm
# 设置pnpm镜像源
RUN pnpm config set registry https://registry.npmmirror.com
# 复制依赖文件
COPY package.json pnpm-lock.yaml ./
# 安装依赖类似npm ci的严格模式
RUN pnpm install --frozen-lockfile
# 复制源代码
COPY . .
# 构建项目
RUN pnpm run build
# 内容组装
FROM nginx:1.29.1 AS final
COPY --from=build /app/dist/build/h5 /usr/share/nginx/html
COPY ./nginx.conf /etc/nginx/nginx.conf
CMD nginx -g "daemon off;"