Skip to content

Document the target architecture of gateway image builds - #763

Open
CrowleyRajapakse wants to merge 1 commit into
wso2:mainfrom
CrowleyRajapakse:docs/gateway-image-build-target-arch
Open

CrowleyRajapakse wants to merge 1 commit into
wso2:mainfrom
CrowleyRajapakse:docs/gateway-image-build-target-arch

Conversation

@CrowleyRajapakse

@CrowleyRajapakse CrowleyRajapakse commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

The ap gateway image build reference doesn't explain how the command chooses the architecture of the images it builds, and it lists flags the command doesn't have:

  • --platform is described as the target platform, but it applies only to the final docker buildx step. The gateway builder compiles the Policy Engine binary for the architecture it runs on. On an ARM64 machine, such as an Apple silicon Mac, --platform linux/amd64 therefore produces a linux/amd64 image with an ARM64 policy-engine, and the gateway runtime fails to start with Exec format error.
  • --platform always pushes, even without --push, and the images aren't loaded into local Docker. The pages don't say so.
  • --version, --gateway-builder, --gateway-controller-base-image, --router-base-image and --offline aren't flags of the command in ap v0.9.1 or on main, so copying them fails with unknown flag. The base images are set in build.yaml.

Goals

Document what each flag does, and how to build images for the build machine's architecture or for another one.

Approach

tools/cli/reference.md, section 11:

  • Remove the nonexistent flags. Add a flags table with defaults, and the names of the two images the command builds.
  • Add a Target architecture section:
    • the two build stages, and why --platform doesn't change the Policy Engine binary;
    • building for the build machine's architecture, including on CI/CD agents;
    • building for another architecture with DOCKER_DEFAULT_PLATFORM;
    • what --platform requires and does: docker buildx, an unconditional push, and one platform per run;
    • checking the compiled binary with --output-dir and file.
  • Give the heading an explicit { #target-architecture } ID. With toc_depth: 3, MkDocs doesn't generate IDs for H4 headings, so links to it would otherwise break.

tools/cli/customizing-gateway-policies.md: fix the flag list (--name has no -n short flag, --path has -p, and --push and --no-cache were missing their dashes), and link --platform to the new section.

Checklist

  • Verified that llms.txt (located at en/docs/llms.txt) is updated for AI readiness content. No change needed: its entries for both pages still describe them correctly.
  • Ensured meaningful alt text for images and that the information contained in an image also appears in text so the relevant info exists in the body of the document. N/A: no images.
  • Added or updated frontmatter for the respective pages. last_updated is set to 2026-11-03 on both pages.

Documentation

Related PRs

Test environment

  • Built the site with mkdocs build using en/requirements.txt. Both pages render, and both links to #target-architecture resolve.
  • Checked the behaviour against cli/src/cmd/gateway/image/build.go and cli/src/internal/gateway/docker_build.go, which are identical in ap/v0.9.1 and on main.
  • Built gateway 1.2.0.19 images on an Apple silicon Mac:
    • Without DOCKER_DEFAULT_PLATFORM, --platform linux/amd64 produced an ARM aarch64 policy-engine.
    • With DOCKER_DEFAULT_PLATFORM=linux/amd64, the build produced an x86-64 policy-engine, both with and without --platform. Without --platform, the images were in local Docker as linux/amd64. The resulting runtime image started and served API requests.
  • The gateway-builder, gateway-runtime and gateway-controller images for 1.0.0, 1.1.0 and 1.2.0 on ghcr.io/wso2/api-platform, and for 1.2.0.19 on registry.wso2.com, list linux/amd64 and linux/arm64.

🤖 Generated with Claude Code

The ap gateway image build reference listed five flags the command
doesn't have, and described --platform as selecting the target
platform. --platform applies only to the docker buildx step. The
gateway builder compiles the Policy Engine binary for the architecture
it runs on, so an ARM64 machine building for linux/amd64 produces an
image whose runtime fails with "Exec format error".

Remove the nonexistent flags, add a flags table, and add a Target
architecture section covering DOCKER_DEFAULT_PLATFORM, the buildx push
behaviour of --platform, single-platform builds, and how to check the
compiled binary. Fix the flag list on the customizing gateway policies
page to match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant