perf: speed up container tests ~20x by eliminating redundant build#20
Merged
perf: speed up container tests ~20x by eliminating redundant build#20
Conversation
…r build Container integration tests took 21+ minutes because: - No .dockerignore: 43GB target/ dir sent as build context every time - Containerfile Stage 1 rebuilt all Rust crates from scratch with LTO, despite host already building the same binaries via `just build-release` - No cargo cache persistence between container builds Fix by: - Adding .dockerignore to exclude target/ (except release binaries) and .git/ - Removing Stage 1 builder from all Containerfiles — copy host-built binaries directly into test images - Adding TSS2 runtime deps to Fedora/Ubuntu containers (needed for host-built binaries that link against libtss2) - Extracting shared _build-test-container recipe in justfile to deduplicate podman build across test-pam, test-integration, test-oneshot, test-shell Container build time drops from ~21 minutes to ~52 seconds. Closes #19 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Speeds up container-based integration/package tests by shrinking the build context and avoiding redundant in-container Rust builds, relying on host-built release artifacts instead.
Changes:
- Add
.dockerignoreto excludetarget/and.git/(while re-including needed release binaries). - Convert Arch/Fedora/Ubuntu test Containerfiles to single-stage images that copy host-built release binaries.
- Deduplicate PAM container build logic in
justfilevia a shared_build-test-containerrecipe.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
.dockerignore |
Reduces container build context size by excluding target/ and .git/ while allowing required binaries through. |
test/Containerfile |
Switches Arch PAM/integration test image to single-stage and copies host-built binaries + needed project files. |
test/Containerfile.fedora |
Switches Fedora package-validation test image to single-stage and adds TPM/TSS runtime dependency. |
test/Containerfile.ubuntu |
Switches Ubuntu package-validation test image to single-stage and adds TPM/TSS runtime dependencies. |
justfile |
Adds _build-test-container and updates PAM/integration/oneshot/shell recipes to reuse it. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The container-pam-test job now uses host-built binaries (matching the local `just test-pam` flow) instead of building from scratch in the container. The build-and-test job uploads release binaries as artifacts, which container-pam-test downloads before running `podman build`. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.dockerignoreto exclude 43GBtarget/dir and.git/from build context_build-test-containerjustfile recipe to deduplicate podman build across 4 test recipesContainer build drops from ~21 minutes to ~52 seconds.
Closes #19
Test plan
podman buildsucceeds for all 3 Containerfiles (Arch, Fedora, Ubuntu)podman run facelock-pam-test— 13/13 PAM smoke tests passpodman run facelock-fedora-test— 16/16 package validation tests passpodman run facelock-ubuntu-test— 16/16 package validation tests passfacelock --version, PAM module, and ONNX models all present in containerjust test-integrationwith camera (requires hardware)🤖 Generated with Claude Code