imbajin opened a new pull request, #399:
URL: https://github.com/apache/hugegraph-ai/pull/399

   ## Background
   
   `rag-bin` spends most of its publication time resolving dependencies and 
compiling a standalone Nuitka distribution. The current `main` Dockerfile also 
weakens cache reuse and copies compilation-only data into the runtime image:
   
   1. All source files are copied before dependency installation, invalidating 
the dependency layer for every source-only change.
   2. The build installs an unpinned latest `uv` instead of the version 
declared by repository CI.
   3. `app.build` is explicitly copied into the runtime image, and local Nuitka 
outputs are not excluded from the Docker build context.
   
   This PR has been rebuilt directly on the latest `main`. It does **not** 
restore the retired LiteLLM workaround or its old Nuitka include scope.
   
   ## Changes
   
   - Pin `uv` to the repository CI version (`0.13.6`).
   - Copy package metadata before application source and resolve third-party 
dependencies in a reusable BuildKit layer.
   - Keep the repository's no-committed-lockfile policy: the metadata layer 
generates `uv.lock`, then the post-source sync consumes that exact graph with 
`--locked`.
   - Reuse a BuildKit uv cache for dependency downloads.
   - Exclude local `app.build`, `app.dist`, and `app.onefile-build` directories 
from the Docker build context.
   - Move only `app.dist` out of the Nuitka output directory and remove 
compilation intermediates before the runtime source copy.
   - Stop copying runtime-unused `pyproject.toml` and `app.build`.
   - Preserve the current non-root user, health check, command, port, 
source/resources mount layout, and current `main` Nuitka include scope.
   - Add eight focused contract tests for the explicit BuildKit frontend, 
clean-checkout behavior, CI-version alignment, layer order/cache reuse, current 
compile scope, context exclusions, intermediate cleanup, and runtime 
compatibility.
   - Document each test's protected behavior so the contract suite remains 
maintainable.
   
   ## Before / after
   
   ```text
   Before
     COPY all source
       -> resolve/download/install dependencies
       -> compile app.dist + app.build
       -> runtime copies source + app.dist + app.build + pyproject
   
   After
     COPY package metadata
       -> resolve dependency graph and cache downloads
     COPY source
       -> locked workspace sync
       -> compile app.dist
       -> delete app.build/app.onefile-build
       -> runtime copies source + app.dist only
   ```
   
   ## Expected impact
   
   - Source-only changes no longer invalidate the 
dependency-resolution/download layer.
   - Dependency downloads can be reused through the BuildKit cache mount.
   - Local compiler outputs no longer inflate the build context or poison 
source-layer caching.
   - The runtime image excludes Nuitka compilation intermediates and unused 
build metadata.
   - Runtime behavior is intentionally unchanged; additional compiler-scope or 
runtime-layout tuning is deferred until a reproducible build/startup benchmark 
supports it.
   
   ## Validation
   
   - Current head: `da67596be69ee2d167e9680a92b8b6b4cf3468cf`
   - Full repository CI: 
https://github.com/hugegraph/hugegraph-ai/actions/runs/42195937377 ✅
     - preflight / license / CI policy
     - format, lint, and type checks
     - LLM dependency installation and unit/contract tests
     - HugeGraph image/version verification
     - HugeGraph boundary and core smoke tests
     - final selected-check gate
   - CodeQL: no new alerts in the changed code.
   - CodeRabbit completed a full successful review on the implementation head 
and found no actionable merge blocker. Its docstring-coverage warning was 
addressed in the final documentation-only commit; the incremental follow-up was 
rate-limited rather than failed.
   - The branch is `0` commits behind `apache/hugegraph-ai:main` and changes 
only `.dockerignore`, `docker/Dockerfile.nk`, and 
`scripts/tests/test_rag_bin_dockerfile.py`.
   - Existing P1/P2 review findings remain addressed: the build does not 
require a committed lockfile, and compilation intermediates are removed before 
the runtime copy.
   - All inline review threads are resolved.
   - Runtime benchmark and failure diagnostics: `hugegraph/actions#42` 
(manual-only after the associated fix).
   
   ## Upstream status
   
   The same branch is cleanly based on `apache/hugegraph-ai:main` and is ready 
for an ASF PR:
   
   
https://github.com/apache/hugegraph-ai/compare/main...hugegraph:perf/rag-bin-build-cache?expand=1
   
   Automated creation through the current GitHub App connection returned `403 
Resource not accessible by integration`; no duplicate or malformed upstream PR 
was created.
   
   
   Source PR: https://github.com/hugegraph/hugegraph-ai/pull/97
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to