chore(frontend): 同步 AGENTS 与 Dockerfile
This commit is contained in:
parent
99cdbcd466
commit
598285abba
|
|
@ -76,6 +76,12 @@ src/
|
||||||
- **MagicUI** - Magic UI components
|
- **MagicUI** - Magic UI components
|
||||||
- **React Bits** - React bits components
|
- **React Bits** - React bits components
|
||||||
|
|
||||||
|
### Interaction Ownership
|
||||||
|
|
||||||
|
- `src/app/workspace/chats/[thread_id]/page.tsx` owns composer busy-state wiring.
|
||||||
|
- `src/core/threads/hooks.ts` owns pre-submit upload state and thread submission.
|
||||||
|
- `src/hooks/usePoseStream.ts` is a passive store selector; global WebSocket lifecycle stays in `App.tsx`.
|
||||||
|
|
||||||
## Resources
|
## Resources
|
||||||
|
|
||||||
- [LangGraph Documentation](https://langchain-ai.github.io/langgraph/)
|
- [LangGraph Documentation](https://langchain-ai.github.io/langgraph/)
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,49 @@
|
||||||
# Frontend Development Dockerfile
|
# Frontend Dockerfile
|
||||||
FROM node:22-alpine
|
# Supports two targets:
|
||||||
|
# --target dev — install deps only, run `pnpm dev` at container start
|
||||||
|
# --target prod — full build baked in, run `pnpm start` at container start (default if no --target is specified)
|
||||||
|
|
||||||
# Accept build argument for pnpm store path
|
|
||||||
ARG PNPM_STORE_PATH=/root/.local/share/pnpm/store
|
ARG PNPM_STORE_PATH=/root/.local/share/pnpm/store
|
||||||
|
|
||||||
# Install pnpm at specific version (matching package.json)
|
# ── Base: shared setup ────────────────────────────────────────────────────────
|
||||||
RUN corepack enable && corepack install -g pnpm@10.26.2
|
FROM node:22-alpine AS base
|
||||||
|
ARG PNPM_STORE_PATH
|
||||||
|
ARG NPM_REGISTRY
|
||||||
|
# Configure corepack registry before installing pnpm so the download itself
|
||||||
|
# succeeds in restricted networks (COREPACK_NPM_REGISTRY controls where
|
||||||
|
# corepack fetches package managers from).
|
||||||
|
RUN if [ -n "${NPM_REGISTRY}" ]; then \
|
||||||
|
export COREPACK_NPM_REGISTRY="${NPM_REGISTRY}"; \
|
||||||
|
fi && \
|
||||||
|
corepack enable && corepack install -g pnpm@10.26.2
|
||||||
RUN pnpm config set store-dir ${PNPM_STORE_PATH}
|
RUN pnpm config set store-dir ${PNPM_STORE_PATH}
|
||||||
|
# Optionally override npm registry for restricted networks (e.g. NPM_REGISTRY=https://registry.npmmirror.com)
|
||||||
# Set working directory
|
RUN if [ -n "${NPM_REGISTRY}" ]; then pnpm config set registry "${NPM_REGISTRY}"; fi
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy frontend source code
|
|
||||||
COPY frontend ./frontend
|
COPY frontend ./frontend
|
||||||
|
|
||||||
# Install dependencies
|
# ── Dev: install only, CMD is overridden by docker-compose ───────────────────
|
||||||
RUN sh -c "cd /app/frontend && pnpm install --frozen-lockfile"
|
FROM base AS dev
|
||||||
|
RUN cd /app/frontend && pnpm install --frozen-lockfile
|
||||||
# Expose Next.js dev server port
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
|
# ── Builder: install + compile Next.js ───────────────────────────────────────
|
||||||
|
FROM base AS builder
|
||||||
|
RUN cd /app/frontend && pnpm install --frozen-lockfile
|
||||||
|
# Skip env validation — runtime vars are injected by nginx/container
|
||||||
|
RUN cd /app/frontend && SKIP_ENV_VALIDATION=1 pnpm build
|
||||||
|
|
||||||
|
# ── Prod: minimal runtime with pre-built output ───────────────────────────────
|
||||||
|
FROM node:22-alpine AS prod
|
||||||
|
ARG PNPM_STORE_PATH
|
||||||
|
ARG NPM_REGISTRY
|
||||||
|
RUN if [ -n "${NPM_REGISTRY}" ]; then \
|
||||||
|
export COREPACK_NPM_REGISTRY="${NPM_REGISTRY}"; \
|
||||||
|
fi && \
|
||||||
|
corepack enable && corepack install -g pnpm@10.26.2
|
||||||
|
RUN pnpm config set store-dir ${PNPM_STORE_PATH}
|
||||||
|
RUN if [ -n "${NPM_REGISTRY}" ]; then pnpm config set registry "${NPM_REGISTRY}"; fi
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=builder /app/frontend ./frontend
|
||||||
|
EXPOSE 3000
|
||||||
|
CMD ["sh", "-c", "cd /app/frontend && pnpm start"]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue