This commit is contained in:
parent
7c2f3ed092
commit
06bf068875
|
|
@ -178,8 +178,7 @@ TradingAgentsX/
|
||||||
### 前置要求
|
### 前置要求
|
||||||
|
|
||||||
- **Python** 3.10+
|
- **Python** 3.10+
|
||||||
- **Node.js** 18.x+
|
- **Node.js** 18.x+ 或 **Bun** 1.x+
|
||||||
- **pnpm** 或 npm
|
|
||||||
|
|
||||||
### 必要的 API 金鑰
|
### 必要的 API 金鑰
|
||||||
|
|
||||||
|
|
@ -225,11 +224,11 @@ python -m backend
|
||||||
#### 3️⃣ 前端設置
|
#### 3️⃣ 前端設置
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 安裝依賴
|
# 安裝依賴(從專案根目錄執行)
|
||||||
pnpm -C frontend install
|
bun install --cwd frontend
|
||||||
|
|
||||||
# 啟動開發伺服器
|
# 啟動開發伺服器
|
||||||
pnpm -C frontend dev
|
bun run --cwd frontend dev
|
||||||
```
|
```
|
||||||
|
|
||||||
前端應用: http://localhost:3000
|
前端應用: http://localhost:3000
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,19 @@
|
||||||
# Multi-stage build for Next.js frontend
|
# 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
|
# Install dependencies only when needed
|
||||||
FROM base AS deps
|
FROM base AS deps
|
||||||
RUN apk add --no-cache libc6-compat
|
RUN apk add --no-cache libc6-compat
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install pnpm
|
|
||||||
RUN corepack enable && corepack prepare pnpm@latest --activate
|
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
COPY package.json pnpm-lock.yaml* ./
|
COPY package.json bun.lock* ./
|
||||||
RUN pnpm install --frozen-lockfile
|
RUN bun install --frozen-lockfile
|
||||||
|
|
||||||
# Rebuild the source code only when needed
|
# Rebuild the source code only when needed
|
||||||
FROM base AS builder
|
FROM base AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install pnpm in builder stage
|
|
||||||
RUN corepack enable && corepack prepare pnpm@latest --activate
|
|
||||||
|
|
||||||
COPY --from=deps /app/node_modules ./node_modules
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
|
@ -27,7 +21,7 @@ COPY . .
|
||||||
ENV NEXT_PUBLIC_API_URL=http://backend:8000
|
ENV NEXT_PUBLIC_API_URL=http://backend:8000
|
||||||
|
|
||||||
# Build Next.js app
|
# Build Next.js app
|
||||||
RUN pnpm run build
|
RUN bun run build
|
||||||
|
|
||||||
# Production image, copy all the files and run next
|
# Production image, copy all the files and run next
|
||||||
FROM base AS runner
|
FROM base AS runner
|
||||||
|
|
@ -55,4 +49,4 @@ EXPOSE 3000
|
||||||
ENV PORT=3000
|
ENV PORT=3000
|
||||||
ENV HOSTNAME="0.0.0.0"
|
ENV HOSTNAME="0.0.0.0"
|
||||||
|
|
||||||
CMD ["node", "server.js"]
|
CMD ["bun", "run", "server.js"]
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,19 @@
|
||||||
# Multi-stage build for Next.js frontend
|
# 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
|
# Install dependencies only when needed
|
||||||
FROM base AS deps
|
FROM base AS deps
|
||||||
RUN apk add --no-cache libc6-compat
|
RUN apk add --no-cache libc6-compat
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install pnpm
|
|
||||||
RUN corepack enable && corepack prepare pnpm@latest --activate
|
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
COPY frontend/package.json frontend/pnpm-lock.yaml* ./
|
COPY frontend/package.json frontend/bun.lock* ./
|
||||||
RUN pnpm install --frozen-lockfile
|
RUN bun install --frozen-lockfile
|
||||||
|
|
||||||
# Rebuild the source code only when needed
|
# Rebuild the source code only when needed
|
||||||
FROM base AS builder
|
FROM base AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Enable pnpm
|
|
||||||
RUN corepack enable && corepack prepare pnpm@latest --activate
|
|
||||||
|
|
||||||
COPY --from=deps /app/node_modules ./node_modules
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
COPY frontend .
|
COPY frontend .
|
||||||
|
|
||||||
|
|
@ -28,7 +22,7 @@ ARG BACKEND_URL
|
||||||
ENV BACKEND_URL=${BACKEND_URL}
|
ENV BACKEND_URL=${BACKEND_URL}
|
||||||
|
|
||||||
# Build Next.js app
|
# Build Next.js app
|
||||||
RUN pnpm run build
|
RUN bun run build
|
||||||
|
|
||||||
# Production image, copy all the files and run next
|
# Production image, copy all the files and run next
|
||||||
FROM base AS runner
|
FROM base AS runner
|
||||||
|
|
@ -56,4 +50,4 @@ EXPOSE 3000
|
||||||
ENV PORT=3000
|
ENV PORT=3000
|
||||||
ENV HOSTNAME="0.0.0.0"
|
ENV HOSTNAME="0.0.0.0"
|
||||||
|
|
||||||
CMD ["node", "server.js"]
|
CMD ["bun", "run", "server.js"]
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,3 +0,0 @@
|
||||||
ignoredBuiltDependencies:
|
|
||||||
- sharp
|
|
||||||
- unrs-resolver
|
|
||||||
Loading…
Reference in New Issue