This commit is contained in:
MarkLo 2025-12-23 10:32:58 +08:00
parent 7c2f3ed092
commit 06bf068875
5 changed files with 1373 additions and 30 deletions

View File

@ -178,8 +178,7 @@ TradingAgentsX/
### 前置要求
- **Python** 3.10+
- **Node.js** 18.x+
- **pnpm** 或 npm
- **Node.js** 18.x+ 或 **Bun** 1.x+
### 必要的 API 金鑰
@ -225,11 +224,11 @@ python -m backend
#### 3⃣ 前端設置
```bash
# 安裝依賴
pnpm -C frontend install
# 安裝依賴(從專案根目錄執行)
bun install --cwd frontend
# 啟動開發伺服器
pnpm -C frontend dev
bun run --cwd frontend dev
```
前端應用: http://localhost:3000

View File

@ -1,25 +1,19 @@
# Multi-stage build for Next.js frontend
FROM node:20-alpine AS base
FROM oven/bun:1-alpine AS base
# Install dependencies only when needed
FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
# Install pnpm
RUN corepack enable && corepack prepare pnpm@latest --activate
# Install dependencies
COPY package.json pnpm-lock.yaml* ./
RUN pnpm install --frozen-lockfile
COPY package.json bun.lock* ./
RUN bun install --frozen-lockfile
# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
# Install pnpm in builder stage
RUN corepack enable && corepack prepare pnpm@latest --activate
COPY --from=deps /app/node_modules ./node_modules
COPY . .
@ -27,7 +21,7 @@ COPY . .
ENV NEXT_PUBLIC_API_URL=http://backend:8000
# Build Next.js app
RUN pnpm run build
RUN bun run build
# Production image, copy all the files and run next
FROM base AS runner
@ -55,4 +49,4 @@ EXPOSE 3000
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
CMD ["node", "server.js"]
CMD ["bun", "run", "server.js"]

View File

@ -1,25 +1,19 @@
# Multi-stage build for Next.js frontend
FROM node:20-alpine AS base
FROM oven/bun:1-alpine AS base
# Install dependencies only when needed
FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
# Install pnpm
RUN corepack enable && corepack prepare pnpm@latest --activate
# Install dependencies
COPY frontend/package.json frontend/pnpm-lock.yaml* ./
RUN pnpm install --frozen-lockfile
COPY frontend/package.json frontend/bun.lock* ./
RUN bun install --frozen-lockfile
# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
# Enable pnpm
RUN corepack enable && corepack prepare pnpm@latest --activate
COPY --from=deps /app/node_modules ./node_modules
COPY frontend .
@ -28,7 +22,7 @@ ARG BACKEND_URL
ENV BACKEND_URL=${BACKEND_URL}
# Build Next.js app
RUN pnpm run build
RUN bun run build
# Production image, copy all the files and run next
FROM base AS runner
@ -56,4 +50,4 @@ EXPOSE 3000
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
CMD ["node", "server.js"]
CMD ["bun", "run", "server.js"]

1359
frontend/bun.lock Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +0,0 @@
ignoredBuiltDependencies:
- sharp
- unrs-resolver