diff --git a/.dockerignore b/.dockerignore index 6e9151c..45ad5b1 100644 --- a/.dockerignore +++ b/.dockerignore @@ -10,3 +10,9 @@ coverage .DS_Store .agents .codex + +# Documentation and CI metadata are not application build inputs. +/docs +/.gitea +/README.md +/AGENTS.md diff --git a/Dockerfile b/Dockerfile index 1d3bc65..eaac23c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,14 +10,8 @@ COPY package.json package-lock.json ./ RUN npm ci FROM dependencies AS build -# Only build inputs belong here: docs and operational notes must not bust this layer. -COPY tsconfig.json next-env.d.ts next.config.ts postcss.config.mjs ./ -COPY src/ ./src/ -COPY public/ ./public/ -COPY scripts/ ./scripts/ -COPY tests/ ./tests/ -COPY db/ ./db/ -COPY seed/ ./seed/ +# .dockerignore excludes docs and operational notes without extra legacy COPY snapshots. +COPY . . RUN npm run typecheck && npm test && npm run build && npm run test:smoke FROM build AS integration diff --git a/docs/ci-and-entrypoints.md b/docs/ci-and-entrypoints.md index 195928d..736a73a 100644 --- a/docs/ci-and-entrypoints.md +++ b/docs/ci-and-entrypoints.md @@ -4,6 +4,6 @@ `ces-control` 必须预装 Docker、Compose,并允许 Runner 访问持久 Docker daemon。CI 只检查环境,不安装系统包、不启停主机服务。当前服务器没有 buildx,先继续使用 daemon 自带层缓存;不要直接粘贴依赖 GitHub cache 服务的 `type=gha` 参数。后续若换 Docker daemon 或清理缓存,会重新冷构建。 -Dockerfile 显式复制构建输入;根 Markdown 和 docs 不再使应用构建层失效。push 和 PR 对纯文档改动使用 paths,但 public 下的 Markdown 属于产品资源,必须构建部署。新添根级构建配置时,需同步 Dockerfile COPY。仍保留类型检查、单元测试、smoke 与完整隔离栈集成测试。 +Dockerfile 保持单次 COPY,`.dockerignore` 排除非构建输入;根 Markdown 和 docs 不再使应用构建层失效。push 和 PR 对纯文档改动使用 paths,但 public 下的 Markdown 属于产品资源,必须构建部署。public 下的技能 Markdown 继续纳入构建。旧 builder 每条 COPY 实测约 47 秒,避免拆成多条 COPY 增加快照成本。仍保留类型检查、单元测试、smoke 与完整隔离栈集成测试。 当前页面为 Next.js SSR 与编译组件,改 TSX 仍需 next build。把 HTML 的 COPY 移到最后不能避免编译。独立挂载静态文件会破坏镜像版本与回滚的一致性;只有真正独立、无需编译的内容才适合后续拆成单独发布渠道。