Repository navigation
build: cross-compile multi-arch image and run as non-root - #94
Merged
Merged
Conversation
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.
Part 2 of 3 of the repository review. This PR only touches
Dockerfileand the build flags inMakefile. Go sources and.githubworkflows are handled in separate PRs.Net change:
Dockerfile+2 lines,Makefileone flag. No new stages,ENV, or files.Changes
AScasing withFROM– removes the BuildKitFromAsCasingwarning on line 1.USER 65534:65534on thescratchstage. A numeric uid:gid needs no/etc/passwd, so the image stays atscratchsize and the.gitcopy that feedslastCommitHash/dirtyBuildvia VCS stamping is unchanged.$BUILDPLATFORMand setsGOARCH=$TARGETARCH.GOOSis left alone: the builder is always a Linux image, soTARGETOSwould be redundant. Multi-arch builds no longer compile Go under QEMU.-ldflags '-s -w'– also strips the symbol table.-X main.Versionis a link-time string injection and is unaffected;/healthstill reportsversion.A
.dockerignorewas added and then removed in this branch. With a stale localappandcoverage.txtin the build context (7.06MB), the image is identical in size,dirtyBuildstaysfalse(both files are gitignored), andmake buildoverwritesappin the builder. CI builds from a fresh checkout that has neither file.Measurements (OrbStack, Docker 29.4, buildx 0.33)
maindocker buildwarningsFromAsCasing)65534:65534(nobody)buildx --platform linux/arm64,linux/amd64 --no-cache-w→-s -w)/healthon the arm64 image:{"version":"local","lastCommitHash":"4f302b85…","dirtyBuild":false}--platform linux/amd64returns the same/healthshape;fileon the extracted binary:ELF 64-bit x86-64, statically linked, stripped.make build,make test,make lintpass locally.