# 第一阶段：构建 Expo Web 静态文件
FROM docker.fairclip.cn/node:22 AS builder
WORKDIR /app
COPY package.json .
# 设置npm源
RUN npm config set registry http://192.168.31.115:8081/repository/npm/
RUN npm install -g expo-cli && npm install
COPY . .
RUN npx expo export -p web

# 第二阶段：使用 nginx 作为 Web 服务器
FROM docker.fairclip.cn/nginx:1.29-alpine
COPY --from=builder /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
