FROM crpi-svwhn8x8nvask31h.cn-beijing.personal.cr.aliyuncs.com/xjzlpublic/node:24-alpine AS builder

LABEL stage=gobuilder

WORKDIR /build

COPY . .

WORKDIR /build/vue

ENV COREPACK_NPM_REGISTRY=https://registry.npmmirror.com

RUN npm config set registry https://registry.npmmirror.com/ && \
    corepack enable && \
    corepack prepare pnpm@10.22.0 --activate && \
    pnpm config set registry https://registry.npmmirror.com/
RUN CI=true pnpm install --frozen-lockfile
RUN CI=true pnpm build

FROM crpi-svwhn8x8nvask31h.cn-beijing.personal.cr.aliyuncs.com/xjzlpublic/nginx:1.30.0-alpine AS alpine

COPY --from=builder /build/vue/apps/web-antd/dist /usr/share/nginx/html
COPY vue/build/nginx.conf /etc/nginx/conf.d/default.conf

# 暴露80端口
EXPOSE 80
# 启动nginx
CMD ["nginx", "-g", "daemon off;"]
