feat(docker): multi-arch builds, healthcheck, dependency caching#308
Open
allamiro wants to merge 1 commit into
Open
feat(docker): multi-arch builds, healthcheck, dependency caching#308allamiro wants to merge 1 commit into
allamiro wants to merge 1 commit into
Conversation
73ed978 to
b5c16c5
Compare
- drop the x86-only RUSTFLAGS (sandybridge/sse) from the Dockerfile and workflows: they made arm64 builds impossible and are redundant, the aes crate uses runtime cpu feature detection - publish linux/amd64 + linux/arm64 images via buildx/qemu - new unauthenticated /health endpoint and a --health-check flag on the binary (scratch has no shell or curl), wired up as HEALTHCHECK - build dependencies in their own docker layer so source changes don't recompile the whole dependency tree - fix stray semicolon in ENV RUST_BACKTRACE
b5c16c5 to
0ee6ff4
Compare
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.
Fixes #226, fixes #289, fixes #290.
Changes
Multi-arch / cross-compilation (#226, #289)
RUSTFLAGS="-Ctarget-cpu=sandybridge ..."from the Dockerfile and both workflows. The flags are x86-only (breaking arm64 builds entirely) and redundant: theaescrate detects AES-NI at runtime, so performance on amd64 is unaffected.container-image.ymlnow builds and pusheslinux/amd64,linux/arm64via setup-qemu/setup-buildx.tonistiigi/xx: the Rust build stage now runs on the native host platform (--platform=$BUILDPLATFORM) and cross-compiles to the target instead of emulating it under QEMU — roughly 10× faster arm64 builds in CI.cache-from/cache-to: type=gha): successive CI runs reuse unchanged layers, dramatically reducing build times after the first run.Healthcheck (#290)
GET /healthendpoint.--health-checkflag that probes/healthover TCP (127.0.0.1 and ::1) — necessary because thescratchimage has no shell or curl — wired up as the DockerfileHEALTHCHECK.Dockerfile quality (#290)
main.rstrick), so source-only changes no longer recompile the whole dependency tree.ENV RUST_BACKTRACE=1;stray semicolon removed (it was part of the value).Validation
docker image inspect:arch=arm64docker inspect:health=healthy;/healthreturns{"status":"ok"}, index serves HTTP 200cargo test: 9/9 pass