FROM node:18-alpine AS builder

WORKDIR /app
COPY package*.json ./
RUN npm install --production=false

COPY . .
RUN npm run build:h5

# 使用Nginx作为运行环境
FROM nginx:alpine

# 复制打包结果到Nginx默认目录
COPY --from=builder /app/dist/build/h5 /usr/share/nginx/html

# 配置Nginx
COPY nginx.conf /etc/nginx/conf.d/default.conf

EXPOSE 8333
CMD ["nginx", "-g", "daemon off;"]
