| FROM node:18-alpine AS build |
| # 设置 npm 镜像源(使用淘宝镜像加速 npm 包下载) |
| RUN npm config set registry https://registry.npmmirror.com |
| # 复制 package.json 和 package-lock.json |
| apt-get install -y tzdata && \ |
| ln -fs /usr/share/zoneinfo/$TZ /etc/localtime && \ |
| echo $TZ > /etc/timezone && \ |
| rm -rf /var/lib/apt/lists/* |
| RUN rm -rf /usr/share/nginx/html/* |
| COPY --from=build /app/dist/ /usr/share/nginx/html/ |
| RUN ls -la /usr/share/nginx/html && \ |
| ls -la /usr/share/nginx/html/assets |
| COPY nginx.conf /etc/nginx/conf.d/default.conf |
| CMD ["nginx", "-g", "daemon off;"] |