agenthub/deploy/Dockerfile.console

28 lines
933 B
Docker
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# AgentHub 控制台前端(Next.js standalone)→ agenthub-console:latest
# build context = 仓库根目录:docker build -f deploy/Dockerfile.console -t agenthub-console:latest .
FROM node:22-alpine AS build
WORKDIR /app
# lockfileVersion 6 → pnpm 8
RUN npm install --no-audit --no-fund --global pnpm@8
COPY frontend/package.json frontend/pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY frontend/ ./
# NEXT_PUBLIC_* 是构建期常量:换一个 hub 地址就要重新 build
ARG NEXT_PUBLIC_HUB_URL=http://127.0.0.1:8100
ARG CSP_CONNECT_SRC=
ENV NEXT_PUBLIC_HUB_URL=$NEXT_PUBLIC_HUB_URL CSP_CONNECT_SRC=$CSP_CONNECT_SRC
RUN pnpm build
FROM node:22-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production HOSTNAME=0.0.0.0 PORT=3100
COPY --from=build /app/.next/standalone ./
COPY --from=build /app/.next/static ./.next/static
COPY --from=build /app/public ./public
USER node
EXPOSE 3100
CMD ["node", "server.js"]