From 0f79c3cc0ec36bbe42139b9ec6f7c48b46a04255 Mon Sep 17 00:00:00 2001 From: Jiahao Luo Date: Mon, 5 Jan 2026 11:10:31 +0800 Subject: [PATCH] =?UTF-8?q?fix(docker):=20=E4=BF=AE=E5=A4=8D=20Dockerfile?= =?UTF-8?q?=20npm=20=E6=9E=84=E5=BB=BA=E9=94=99=E8=AF=AF=E5=B9=B6=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E6=B5=8B=E8=AF=95=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复 Dockerfile 使用 pnpm 替代 npm ci(适配 pnpm 迁移) - 为 docker-compose-test.yml 添加自动构建配置 - 更新测试配置文档说明一键构建命令 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- Dockerfile | 9 ++++++--- deploy/docker-compose-test.yml | 10 +++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9e83603a..8ccd8629 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,13 +19,16 @@ FROM ${NODE_IMAGE} AS frontend-builder WORKDIR /app/frontend +# Install pnpm +RUN corepack enable && corepack prepare pnpm@latest --activate + # Install dependencies first (better caching) -COPY frontend/package*.json ./ -RUN npm ci +COPY frontend/package.json frontend/pnpm-lock.yaml ./ +RUN pnpm install --frozen-lockfile # Copy frontend source and build COPY frontend/ ./ -RUN npm run build +RUN pnpm run build # ----------------------------------------------------------------------------- # Stage 2: Backend Builder diff --git a/deploy/docker-compose-test.yml b/deploy/docker-compose-test.yml index b73d4a26..1a02fedd 100644 --- a/deploy/docker-compose-test.yml +++ b/deploy/docker-compose-test.yml @@ -1,12 +1,13 @@ # ============================================================================= -# Sub2API Docker Compose Configuration +# Sub2API Docker Compose Test Configuration (Local Build) # ============================================================================= # Quick Start: # 1. Copy .env.example to .env and configure -# 2. docker-compose up -d -# 3. Check logs: docker-compose logs -f sub2api +# 2. docker-compose -f docker-compose-test.yml up -d --build +# 3. Check logs: docker-compose -f docker-compose-test.yml logs -f sub2api # 4. Access: http://localhost:8080 # +# This configuration builds the image from source (Dockerfile in project root). # All configuration is done via environment variables. # No Setup Wizard needed - the system auto-initializes on first run. # ============================================================================= @@ -17,6 +18,9 @@ services: # =========================================================================== sub2api: image: sub2api:latest + build: + context: .. + dockerfile: Dockerfile container_name: sub2api restart: unless-stopped ulimits: