Files
aiot-uniapp/Dockerfile
feige996 4e3942eca8 feat(docker): 添加docker相关配置和文档
添加Dockerfile、.dockerignore、nginx.conf配置文件
新增docker.md文档说明构建和运行步骤
更新.vscode设置支持docker文件嵌套
2025-09-17 10:37:59 +08:00

24 lines
542 B
Docker
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 前端打包
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;"