# 平台管理后台
FROM node:18-alpine AS platform-builder
WORKDIR /app
COPY pnpm-workspace.yaml pnpm-lock.yaml package.json ./
COPY packages/ ./packages/
COPY apps/platform-admin/ ./apps/platform-admin/
RUN npm install -g pnpm@8 && pnpm install --frozen-lockfile
RUN pnpm --filter @rent/shared-types build
RUN pnpm --filter @rent/shared-utils build
RUN cd apps/platform-admin && pnpm run build

FROM nginx:alpine AS platform
COPY --from=platform-builder /app/apps/platform-admin/dist /usr/share/nginx/html
COPY deploy/nginx/platform.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
