FROM node:16

WORKDIR /app

# 先安装构建工具
RUN npm install -g @vue/cli @dcloudio/uni-cli

# 安装依赖
COPY package*.json ./
RUN npm install --legacy-peer-deps

# 复制源码并构建
COPY . .
RUN npm run build:h5

# 生产阶段
FROM nginx:stable-alpine
COPY --from=build-stage /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 8333
CMD ["nginx", "-g", "daemon off;"]
