新增: - Jenkinsfile:master→PROD(172.17.16.14)、release/next→STAGING(172.17.16.7) 镜像推 172.17.16.7:5000/aiot-iot-ui,宿主机暴露 90 - docker-compose.frontend.yml:nginx 容器加入 1panel-network - 根 Dockerfile + apps/web-antd/nginx.conf:与 vben 前端结构对齐 nginx 反代 /admin-api → http://aiot-gateway:48080 修复: - .env.production VITE_GLOB_API_URL 硬编码 127.0.0.1 → /admin-api(走 nginx 反代) - scripts/deploy/Dockerfile 引用不存在的 playground/dist → apps/web-antd/dist 并改用 turbo 单 filter 构建(与根 Dockerfile 一致)
38 lines
943 B
Docker
38 lines
943 B
Docker
FROM node:22-slim AS builder
|
||
|
||
# --max-old-space-size
|
||
ENV PNPM_HOME="/pnpm"
|
||
ENV PATH="$PNPM_HOME:$PATH"
|
||
ENV NODE_OPTIONS=--max-old-space-size=8192
|
||
ENV TZ=Asia/Shanghai
|
||
|
||
RUN npm i -g corepack
|
||
|
||
WORKDIR /app
|
||
|
||
# copy package.json and pnpm-lock.yaml to workspace
|
||
COPY . /app
|
||
|
||
# 安装依赖
|
||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
||
RUN pnpm exec turbo build --filter=@vben/web-antd --concurrency=1
|
||
|
||
RUN echo "Builder Success 🎉"
|
||
|
||
FROM nginx:stable-alpine AS production
|
||
|
||
# 配置 nginx
|
||
RUN echo "types { application/javascript js mjs; }" > /etc/nginx/conf.d/mjs.conf \
|
||
&& rm -rf /etc/nginx/conf.d/default.conf
|
||
|
||
# 复制构建产物(vben monorepo 主入口为 apps/web-antd)
|
||
COPY --from=builder /app/apps/web-antd/dist /usr/share/nginx/html
|
||
|
||
# 复制 nginx 配置
|
||
COPY --from=builder /app/scripts/deploy/nginx.conf /etc/nginx/nginx.conf
|
||
|
||
EXPOSE 8080
|
||
|
||
# 启动 nginx
|
||
CMD ["nginx", "-g", "daemon off;"]
|