# 第一阶段：构建前端静态资源
FROM node:24-alpine AS build

ARG VITE_ADMIN_BASE_PATH=/manage-7x9k2p
ENV VITE_ADMIN_BASE_PATH=${VITE_ADMIN_BASE_PATH}

WORKDIR /src
COPY frontend/package*.json ./
RUN npm install
COPY frontend/ .
RUN npm run build

# 第二阶段：Caddy 作为公网入口，同时托管前端 dist
FROM caddy:2.10-alpine

COPY --from=build /src/dist /srv/dist
EXPOSE 80 443
