From 557eee9a0661c6be2dac2f8538d6c624bbf7cd65 Mon Sep 17 00:00:00 2001 From: Miles Ward Date: Thu, 17 Sep 2026 19:21:22 -0400 Subject: [PATCH] publish script: find Docker CLI plugins under the private DOCKER_CONFIG With an isolated DOCKER_CONFIG the CLI looks for buildx only in $DOCKER_CONFIG/cli-plugins, fell back to the legacy builder, and rejected --provenance. Symlink the user's plugin dir, honour Homebrew's, and fail early if buildx is still missing. Co-Authored-By: Claude Fable 5.1 --- scripts/build-and-publish-unraid.sh | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/scripts/build-and-publish-unraid.sh b/scripts/build-and-publish-unraid.sh index 650a561..dc50eed 100755 --- a/scripts/build-and-publish-unraid.sh +++ b/scripts/build-and-publish-unraid.sh @@ -61,12 +61,28 @@ DOCKER_CONFIG="$(mktemp -d)" export DOCKER_CONFIG trap 'rm -rf "$DOCKER_CONFIG" "$WORKDIR"' EXIT +# CLI plugins (buildx, needed for --platform/--provenance) are looked up under +# $DOCKER_CONFIG/cli-plugins, so the private config would otherwise fall back +# to the legacy builder. Point it at the user's plugins and at Homebrew's. +if [[ -d "$HOME/.docker/cli-plugins" ]]; then + ln -s "$HOME/.docker/cli-plugins" "$DOCKER_CONFIG/cli-plugins" +fi +for extra in /opt/homebrew/lib/docker/cli-plugins /usr/local/lib/docker/cli-plugins; do + if [[ -d "$extra" ]]; then + printf '{"cliPluginsExtraDirs":["%s"]}' "$extra" > "$DOCKER_CONFIG/config.json" + break + fi +done + # Colima keeps its socket outside /var/run; an isolated DOCKER_CONFIG has no # `currentContext`, so point at the daemon explicitly when one is not set. if [[ -z "${DOCKER_HOST:-}" && -S "$HOME/.colima/default/docker.sock" ]]; then export DOCKER_HOST="unix://$HOME/.colima/default/docker.sock" fi +docker buildx version >/dev/null 2>&1 \ + || { echo "ERROR: docker buildx plugin not found (needed for --platform builds)." >&2; exit 2; } + echo echo "==> Workspace : $WORKDIR" echo "==> Gitea host : $GITEA_HOST" @@ -105,7 +121,8 @@ docker build \ . # Step 3: registry auth, written straight into the private config (see above). -printf '{"auths":{"%s":{"auth":"%s"}}}' "$GITEA_HOST" \ +EXTRA_DIRS="$(sed -n 's/.*"cliPluginsExtraDirs":\(\[[^]]*\]\).*/\1/p' "$DOCKER_CONFIG/config.json" 2>/dev/null || true)" +printf '{"cliPluginsExtraDirs":%s,"auths":{"%s":{"auth":"%s"}}}' "${EXTRA_DIRS:-[]}" "$GITEA_HOST" \ "$(printf '%s:%s' "$GITEA_OWNER" "$GITEA_TOKEN" | base64 | tr -d '\n')" \ > "$DOCKER_CONFIG/config.json"