feat(docker): 添加docker相关配置和文档
添加Dockerfile、.dockerignore、nginx.conf配置文件 新增docker.md文档说明构建和运行步骤 更新.vscode设置支持docker文件嵌套
This commit is contained in:
23
Dockerfile
Normal file
23
Dockerfile
Normal 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;"
|
||||
Reference in New Issue
Block a user