mirror of
https://github.com/games-on-whales/LXC2Docker.git
synced 2026-10-16 05:12:04 +00:00
[PR #41] [MERGED] feat(build): BuildKit/buildx support via an LLB solver on LXC #42
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
games-on-whales/LXC2Docker#42
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/games-on-whales/LXC2Docker/pull/41
Author: @JBailes
Created: 5/31/2026
Status: ✅ Merged
Merged: 5/31/2026
Merged by: @JBailes
Base:
main← Head:feat/buildkit-llb-on-lxc📝 Commits (3)
f2b71b2feat(build): BuildKit/buildx support via an LLB solver on LXC3d5ee39feat(build): persistent content cache for fully content-addressed LLB ops8c11673feat(build): run executor RUN steps in a real LXC container, not a chroot📊 Changes
19 files changed (+2503 additions, -10 deletions)
View changed files
📝
go.mod(+58 -2)📝
go.sum(+164 -2)📝
internal/api/build.go(+24 -2)➕
internal/api/buildkit_cache.go(+26 -0)➕
internal/api/buildkit_cache_store.go(+124 -0)➕
internal/api/buildkit_cache_store_test.go(+47 -0)➕
internal/api/buildkit_cache_test.go(+42 -0)➕
internal/api/buildkit_exec.go(+541 -0)➕
internal/api/buildkit_exec_test.go(+154 -0)➕
internal/api/buildkit_grpc.go(+199 -0)➕
internal/api/buildkit_grpc_test.go(+116 -0)➕
internal/api/buildkit_import.go(+170 -0)➕
internal/api/buildkit_llb.go(+82 -0)➕
internal/api/buildkit_llb_test.go(+79 -0)➕
internal/api/buildkit_solve.go(+338 -0)➕
internal/api/buildkit_solve_test.go(+248 -0)📝
internal/api/router.go(+6 -0)📝
internal/api/system.go(+8 -4)➕
internal/lxc/build_run.go(+77 -0)📄 Description
What
Makes
docker buildx buildwork against docker-lxc-daemon by speaking the BuildKit Control gRPC API and executing the LLB op DAG directly on LXC — a real LLB solver, not a shim.How
/grpcControl endpoint (h2c hijack,buildkit_grpc.go):Info,ListWorkers,Session,Solve,Status,DiskUsage,Prune. Ping now advertisesBuilder-Version: 2so buildx uses the docker driver.Solve(buildkit_solve.go) drives thedockerfile.v0frontend: pulls context+Dockerfile over the session FileSync, converts to LLB viadockerfile2llb, executes, imports the result, streams vertex/log status.buildkit_exec.go) materialises thepb.OpDAG with directory snapshots:Source(docker-image via the daemon's existing image resolution;local://context),Exec(RUN in a chroot),File(COPY/ADD/mkdir/rm/symlink with action-chaining).RUN --mount=type=secretresolved from the client session, written to the rootfs only for the RUN and deleted afterwards (never persists in the image).--output type=tar|localstream the result back to the client over FileSend.POST /buildis unchanged — its core was extracted asbuildFromContextand is shared.Bug fixes (found while validating)
statusRecorder(the request-logging middleware) now forwardsHijack(). It previously masked thehttp.Hijacker, which silently broke/grpcandexec/attachthrough the middleware.Validation
Live-tested on a Proxmox host (isolated daemon, production untouched):
FROM scratch+COPY→ correct image in storeFROM busybox+RUN+COPY+ multi-RUN→ RUN output streamed, image rootfs has both RUN- and COPY-produced files--output type=tar→ correct client-side tarballUnit tests cover the gRPC handshake, Solve/Status correlation, frontend-attr parsing, LLB conversion, File-op chaining, secret staging, and DiskUsage/Prune.
⚠️ Integration notes for the maintainer
feat/deb-packaging(the chosen base) so the diff is buildx-only.origin/mainhas since merged #40 "run RUN steps in a real LXC container", which rewritesbuild.go's RUN path (plusmanager.go/network.go). This branch predates #40, so it will need a rebase ontomainand reconciliation: notably, this executor runsRUNviachroot, while #40 moved classic builds to real LXC containers — we should align on one execution model.--pushand oci/docker image-tarball exporters are intentionally out of scope (the daemon has no registry push).du/prunereal data).🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.