FROM registry.cn-shenzhen.aliyuncs.com/zuoge-proxy/node:20-alpine AS build

# 设置环境变量，限制 Node.js 内存并禁用 source map
ENV NODE_OPTIONS="--max-old-space-size=1024"
ENV GENERATE_SOURCEMAP=false

WORKDIR /app
COPY package*.json yarn.lock ./
RUN yarn install --frozen-lockfile
COPY . .
RUN yarn build

# 部署阶段
FROM crpi-an5dzzjadzt6601u.cn-shenzhen.personal.cr.aliyuncs.com/softnook-proxy/nginx:1.27.3-alpine AS app
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80