Support arm64 Govard images on macOS#60
Merged
Merged
Conversation
Owner
|
Close #59 |
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
This PR makes Govard handle Apple Silicon/macOS image workflows more reliably.
amd64images ondarwin/arm64when the image already exists but is incompatible with the host.govard up,govard env pull, andgovard doctor --fix, so the fix applies even when images are present anddocker compose pulldoes not report them as missing.DOCKER_PLATFORMSsupport formake imagesandmake push, with macOS defaulting tolinux/amd64,linux/arm64and single-platform overrides still supported.docker-containerbuilder for multi-platform builds and fails early with a clear message if the requested platform is not supported.www-data, then dropping back towww-databefore running the final command.Root Cause
On Apple Silicon, Docker can have a Govard-managed image in the local cache with
amd64architecture. Because the image exists, the previous fallback path did not rebuild it, but the runtime could still be using an image that is incompatible with the host.The PHP entrypoint also attempted to call
sudoafter changing the UID forwww-data. At that point, the current process could be running under a numeric UID that no longer resolves in/etc/passwd, which causessudoto fail withyou do not exist in the passwd database.For image publishing,
docker buildx bakewith multiple platforms fails on Docker's defaultdockerbuilder. Multi-platform builds need a compatible builder such asdocker-container, or a clear preflight failure when the requested platform is not available.Implementation Notes
FallbackBuildMissingGovardImagesFromComposenow delegates to a shared build path that can build missing images and rebuild incompatible local images.RebuildIncompatibleGovardImagesFromComposeinspects existing local image architecture and rebuilds Govard-managedamd64images only ondarwin/arm64.govard up,env pull, anddoctor --fixcall the incompatible-image rebuild path after compose rendering/pull handling.scripts/docker-buildx-bake.shpreserves the existing bake interface while selecting a multi-platform builder only whenDOCKER_PLATFORMScontains more than one platform.www-dataat the end.Tests
go test -count=1 ./testsgo test -count=1 ./internal/engine ./internal/cmdgit diff --checksh -n scripts/docker-buildx-bake.shmake -n images DOCKER_PLATFORMS=linux/amd64,linux/arm64make -n push DOCKER_PLATFORMS=linux/amd64,linux/arm64DOCKER_PLATFORMS=linux/arm64 ./scripts/docker-buildx-bake.sh -f docker/docker-bake.hcl --set "*.platform=linux/arm64" --print dnsmasqlinux/arm64.PUID=2000andPGID=2000; the final command ran as UID2000, andwww-dataresolved to UID2000.