From 8cb9495c0f6d1ef0ed5be11ead974f5b4af86f83 Mon Sep 17 00:00:00 2001 From: TNT-Likely Date: Sun, 4 Oct 2026 23:57:33 +0800 Subject: [PATCH 1/3] ci(release): speed up multi-platform image builds --- .github/workflows/release.yml | 5 +++-- Dockerfile | 9 ++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 508f48b49..3bcde9622 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -121,8 +121,9 @@ jobs: labels: ${{ steps.meta.outputs.labels }} build-args: | VERSION=${{ steps.vars.outputs.version }} - cache-from: type=gha - cache-to: type=gha,mode=max + # 固定 registry 引用,让不同发布 tag 复用包含中间 builder 的缓存。 + cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache + cache-to: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache,mode=max - name: Generate release notes (tag push only) if: ${{ github.event_name == 'push' }} diff --git a/Dockerfile b/Dockerfile index 21961a376..ce3295d45 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,8 @@ # 多阶段构建,减小最终镜像大小 # ===== Stage 1: 前端构建 ===== -FROM node:24.14.0-alpine AS frontend-builder +# 静态资源与目标架构无关,使用构建机原生平台,避免 ARM 镜像构建时通过 QEMU 跑 pnpm。 +FROM --platform=$BUILDPLATFORM node:24.14.0-alpine AS frontend-builder WORKDIR /app/frontend @@ -42,9 +43,6 @@ RUN sed 's/^-e //' requirements-runtime.txt > /tmp/requirements-runtime.txt \ # ===== Stage 3: Python 运行环境 ===== FROM python:3.11-slim-bookworm -# 版本号(构建时传入) -ARG VERSION=dev - WORKDIR /app # 安装系统依赖 @@ -98,7 +96,8 @@ COPY src/ ./src/ COPY server.py ./ COPY prompts/ ./prompts/ -# 写入版本号 +# 写入版本号;延后声明,避免换版本号时让系统依赖安装缓存失效。 +ARG VERSION=dev RUN echo "${VERSION}" > VERSION # 从前端构建阶段复制静态文件 From 3f5b7fc54612f8641c633e59fa0596be4d55f05e Mon Sep 17 00:00:00 2001 From: TNT-Likely Date: Mon, 5 Oct 2026 00:05:51 +0800 Subject: [PATCH 2/3] test(assistant): wait for the runner before checking completion --- tests/test_assistant_task_runner.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/test_assistant_task_runner.py b/tests/test_assistant_task_runner.py index 53419ea42..e1e74728b 100644 --- a/tests/test_assistant_task_runner.py +++ b/tests/test_assistant_task_runner.py @@ -213,11 +213,10 @@ def complete_task_with_message(self, task_id, conversation_id, content): async def run(): runner.start_message(task_id, conversation_id) - for _ in range(20): - if repository.get_task_snapshot(task_id)["status"] == "completed": - return - await asyncio.sleep(0.01) - raise AssertionError("runner did not finish") + # Wait for the worker before reading the shared in-memory SQLite connection. + async with asyncio.timeout(5): + while runner.is_running(task_id): + await asyncio.sleep(0.01) asyncio.run(run()) events = repository.list_task_events(task_id, after_sequence=2) From d5c88c184e7665bb44c1885f31df75d8f40095ad Mon Sep 17 00:00:00 2001 From: TNT-Likely Date: Mon, 5 Oct 2026 00:33:09 +0800 Subject: [PATCH 3/3] ci(docker): exclude generated Python files from build context --- .dockerignore | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.dockerignore b/.dockerignore index 6c1161b77..cfde6de84 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,12 +3,14 @@ .gitignore # Python -__pycache__ -*.pyc -*.pyo +**/__pycache__/ +**/*.pyc +**/*.pyo +**/.pytest_cache/ venv/ .venv/ -*.egg-info/ +**/*.egg-info/ +packages/*/build/ # Node node_modules/ @@ -31,6 +33,7 @@ static/ # Docs .claude/ +.docs/ docs/ *.md !README.md