From 04346b4278606211cbc19fe8a30366219987ee88 Mon Sep 17 00:00:00 2001 From: Renuka Fernando Date: Thu, 14 May 2026 15:57:45 +0530 Subject: [PATCH 1/2] build: include LICENSE in gateway and event-gateway images Stage the repo-root LICENSE into each image's /app/LICENSE via the target/ build-context pattern across both regular and multi-arch builds (and debug/coverage variants). - gateway/gateway-runtime, gateway-controller - event-gateway/gateway-runtime, event-gateway-controller - add target/ build-context to gateway-controller (was absent) - gitignore the new gateway-controller and event-gateway-runtime target/ dirs Templated Dockerfiles inherit /app/LICENSE from the updated base images, so no template changes are needed. --- .gitignore | 2 ++ event-gateway/Makefile | 8 ++++++++ event-gateway/gateway-runtime/Dockerfile | 1 + .../gateway-runtime/Dockerfile.debug | 1 + event-gateway/gateway-runtime/Makefile | 12 ++++++++--- gateway/gateway-controller/Dockerfile | 4 +++- gateway/gateway-controller/Makefile | 16 +++++++++++++++ gateway/gateway-runtime/Dockerfile | 2 ++ gateway/gateway-runtime/Makefile | 20 +++++++++++++++---- 9 files changed, 58 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 06f3b88e95..4811fae964 100644 --- a/.gitignore +++ b/.gitignore @@ -141,6 +141,8 @@ platform-api/src/resources/openapi_with_binding.yaml # Gateway gateway/gateway-runtime/target +gateway/gateway-controller/target/ +event-gateway/gateway-runtime/target/ dev-policies/ # Copilot Prompts diff --git a/event-gateway/Makefile b/event-gateway/Makefile index dc571153d1..66724d63a5 100644 --- a/event-gateway/Makefile +++ b/event-gateway/Makefile @@ -73,6 +73,8 @@ build: build-event-gateway-controller build-gateway-runtime build-webhook-listen # once gateway-builder is integrated into the event-gateway build pipeline. build-event-gateway-controller: ## Build event-gateway-controller Docker image @echo "Building event-gateway-controller Docker image ($(VERSION))..." + @mkdir -p ../gateway/gateway-controller/target + @cp ../LICENSE ../gateway/gateway-controller/target/ @cd ../gateway/gateway-controller && \ docker buildx build -f Dockerfile \ --build-context sdk=../../sdk \ @@ -80,6 +82,7 @@ build-event-gateway-controller: ## Build event-gateway-controller Docker image --build-context common=../../common \ --build-context build-manifest=.. \ --build-context policies=../../event-gateway/default-policies \ + --build-context target=target \ --build-arg VERSION=$(VERSION) \ --build-arg FUNCTIONALITY_TYPE=event \ --build-arg GIT_COMMIT=$$(git rev-parse --short HEAD 2>/dev/null || echo "unknown") \ @@ -87,6 +90,7 @@ build-event-gateway-controller: ## Build event-gateway-controller Docker image -t $(EVENT_GATEWAY_CONTROLLER_IMAGE):$(VERSION) \ --load \ . + @rm -rf ../gateway/gateway-controller/target .PHONY: build-gateway-runtime build-gateway-runtime: ## Build event-gateway-runtime Docker image @@ -107,6 +111,8 @@ build-and-push-multiarch: build-and-push-multiarch-event-gateway-controller buil # once gateway-builder is integrated into the event-gateway build pipeline. build-and-push-multiarch-event-gateway-controller: ## Build and push event-gateway-controller Docker image for multiple architectures @echo "Building and pushing multi-arch event-gateway-controller Docker image ($(VERSION))..." + @mkdir -p ../gateway/gateway-controller/target + @cp ../LICENSE ../gateway/gateway-controller/target/ @cd ../gateway/gateway-controller && \ docker buildx build -f Dockerfile \ --build-context sdk=../../sdk \ @@ -114,6 +120,7 @@ build-and-push-multiarch-event-gateway-controller: ## Build and push event-gatew --build-context common=../../common \ --build-context build-manifest=.. \ --build-context policies=../../event-gateway/default-policies \ + --build-context target=target \ --platform linux/amd64,linux/arm64 \ --build-arg VERSION=$(VERSION) \ --build-arg FUNCTIONALITY_TYPE=event \ @@ -122,6 +129,7 @@ build-and-push-multiarch-event-gateway-controller: ## Build and push event-gatew -t $(EVENT_GATEWAY_CONTROLLER_IMAGE):$(VERSION) \ --push \ . + @rm -rf ../gateway/gateway-controller/target .PHONY: build-and-push-multiarch-gateway-runtime build-and-push-multiarch-gateway-runtime: ## Build and push event-gateway-runtime Docker image for multiple architectures diff --git a/event-gateway/gateway-runtime/Dockerfile b/event-gateway/gateway-runtime/Dockerfile index 50a716d404..5a370ac802 100644 --- a/event-gateway/gateway-runtime/Dockerfile +++ b/event-gateway/gateway-runtime/Dockerfile @@ -111,6 +111,7 @@ RUN apk add --no-cache ca-certificates bash tini && \ WORKDIR /app COPY --from=policy-compiler /api-platform/output/event-gateway/event-gateway /app/event-gateway +COPY --from=target LICENSE /app/LICENSE COPY configs/config.toml /etc/event-gateway/config.toml COPY configs/channels.yaml /etc/event-gateway/channels.yaml COPY docker-entrypoint.sh /app/docker-entrypoint.sh diff --git a/event-gateway/gateway-runtime/Dockerfile.debug b/event-gateway/gateway-runtime/Dockerfile.debug index a45921fbe5..7cf168eabd 100644 --- a/event-gateway/gateway-runtime/Dockerfile.debug +++ b/event-gateway/gateway-runtime/Dockerfile.debug @@ -115,6 +115,7 @@ RUN go install github.com/go-delve/delve/cmd/dlv@latest WORKDIR /app COPY --from=policy-compiler /api-platform/output/event-gateway/event-gateway /app/event-gateway +COPY --from=target LICENSE /app/LICENSE COPY configs/config.toml /etc/event-gateway/config.toml COPY configs/channels.yaml /etc/event-gateway/channels.yaml diff --git a/event-gateway/gateway-runtime/Makefile b/event-gateway/gateway-runtime/Makefile index e98eb8e30d..341d4644fd 100644 --- a/event-gateway/gateway-runtime/Makefile +++ b/event-gateway/gateway-runtime/Makefile @@ -80,7 +80,9 @@ debug-local: generate ## Build locally with debug symbols and launch Delve on :2 .PHONY: build-docker build-docker: ## Build Docker image @echo "Building event-gateway-runtime Docker image ($(VERSION))..." - @mkdir -p target && cp ../build.yaml target/ + @mkdir -p target + @cp ../build.yaml target/ + @cp ../../LICENSE target/ docker buildx build \ --load \ --platform linux/$(shell uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/') \ @@ -100,7 +102,9 @@ build-docker: ## Build Docker image .PHONY: build-debug build-debug: ## Build Docker image with Delve remote debugger (port 2345) @echo "Building event-gateway-runtime debug Docker image ($(VERSION))..." - @mkdir -p target && cp ../build.yaml target/ + @mkdir -p target + @cp ../build.yaml target/ + @cp ../../LICENSE target/ docker buildx build \ --load \ --platform linux/$(shell uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/') \ @@ -120,7 +124,9 @@ build-debug: ## Build Docker image with Delve remote debugger (port 2345) .PHONY: build-and-push-multiarch build-and-push-multiarch: ## Build and push Docker image for multiple architectures @echo "Building and pushing multi-arch event-gateway-runtime Docker image ($(VERSION))..." - @mkdir -p target && cp ../build.yaml target/ + @mkdir -p target + @cp ../build.yaml target/ + @cp ../../LICENSE target/ docker buildx build \ --push \ --platform linux/amd64,linux/arm64 \ diff --git a/gateway/gateway-controller/Dockerfile b/gateway/gateway-controller/Dockerfile index 9a705d657b..8c1be3cb1f 100644 --- a/gateway/gateway-controller/Dockerfile +++ b/gateway/gateway-controller/Dockerfile @@ -88,6 +88,7 @@ RUN --mount=type=cache,target=/go/pkg/mod \ COPY --from=builder /build/controller . COPY --from=build-manifest build-manifest.yaml /app/build-manifest.yaml COPY --from=policies . /app/default-policies +COPY --from=target LICENSE /app/LICENSE COPY lua /app/lua COPY default-llm-provider-templates /app/default-llm-provider-templates @@ -117,11 +118,12 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ rm -rf /var/lib/apt/lists/* WORKDIR /app -# Copy build manifest +# Copy build manifest COPY --from=build-manifest build-manifest.yaml /app/build-manifest.yaml COPY --from=builder /build/controller . COPY --from=policies . /app/default-policies +COPY --from=target LICENSE /app/LICENSE COPY lua /app/lua COPY default-llm-provider-templates /app/default-llm-provider-templates diff --git a/gateway/gateway-controller/Makefile b/gateway/gateway-controller/Makefile index cf126c252a..dca046446d 100644 --- a/gateway/gateway-controller/Makefile +++ b/gateway/gateway-controller/Makefile @@ -74,12 +74,15 @@ test: ## Run unit and integration tests build: generate-server-code test ## Build Docker image using buildx @echo "Building Docker image ($(IMAGE_NAME):$(VERSION))..." + @mkdir -p target + @cp ../../LICENSE target/ docker buildx build -f Dockerfile \ --build-context sdk=../../sdk \ --build-context sdk-core=../../sdk/core \ --build-context common=../../common \ --build-context build-manifest=.. \ --build-context policies=$(POLICIES_BUILD_CONTEXT) \ + --build-context target=target \ --build-arg VERSION=$(VERSION) \ --build-arg FUNCTIONALITY_TYPE=$(FUNCTIONALITY_TYPE) \ --build-arg GIT_COMMIT=$(GIT_COMMIT) \ @@ -88,6 +91,7 @@ build: generate-server-code test ## Build Docker image using buildx -t $(IMAGE_NAME):latest \ --load \ . + @rm -rf target @echo "Docker image ($(IMAGE_NAME):$(VERSION)) built successfully." push: ## Push Docker image to registry @@ -97,12 +101,15 @@ push: ## Push Docker image to registry build-and-push-multiarch: ## Build and push multi-architecture Docker image (linux/amd64, linux/arm64) @echo "Building and pushing multi-arch Docker image: $(IMAGE_NAME):$(VERSION)" + @mkdir -p target + @cp ../../LICENSE target/ docker buildx build -f Dockerfile \ --build-context sdk=../../sdk \ --build-context sdk-core=../../sdk/core \ --build-context common=../../common \ --build-context build-manifest=.. \ --build-context policies=$(POLICIES_BUILD_CONTEXT) \ + --build-context target=target \ --platform linux/amd64,linux/arm64 \ --build-arg VERSION=$(VERSION) \ --build-arg FUNCTIONALITY_TYPE=$(FUNCTIONALITY_TYPE) \ @@ -112,14 +119,18 @@ build-and-push-multiarch: ## Build and push multi-architecture Docker image (lin -t $(IMAGE_NAME):latest \ --push \ . + @rm -rf target build-coverage-image: test ## Build coverage-instrumented gateway-controller image + @mkdir -p target + @cp ../../LICENSE target/ docker buildx build -f Dockerfile \ --build-context sdk=../../sdk \ --build-context sdk-core=../../sdk/core \ --build-context common=../../common \ --build-context build-manifest=.. \ --build-context policies=$(POLICIES_BUILD_CONTEXT) \ + --build-context target=target \ --build-arg VERSION=$(VERSION) \ --build-arg FUNCTIONALITY_TYPE=$(FUNCTIONALITY_TYPE) \ --build-arg GIT_COMMIT=$(GIT_COMMIT) \ @@ -128,14 +139,18 @@ build-coverage-image: test ## Build coverage-instrumented gateway-controller ima -t $(IMAGE_NAME)-coverage:$(VERSION) \ --load \ . + @rm -rf target build-debug: ## Build debug image for remote debugging with dlv (VS Code attach on port 2345) + @mkdir -p target + @cp ../../LICENSE target/ docker buildx build -f Dockerfile \ --build-context sdk=../../sdk \ --build-context sdk-core=../../sdk/core \ --build-context common=../../common \ --build-context build-manifest=.. \ --build-context policies=$(POLICIES_BUILD_CONTEXT) \ + --build-context target=target \ --build-arg VERSION=$(VERSION) \ --build-arg FUNCTIONALITY_TYPE=$(FUNCTIONALITY_TYPE) \ --build-arg GIT_COMMIT=$(GIT_COMMIT) \ @@ -145,6 +160,7 @@ build-debug: ## Build debug image for remote debugging with dlv (VS Code attach -t $(IMAGE_NAME)-debug:latest \ --load \ . + @rm -rf target generate-listener-certs: ## Generate listener certificates @echo "Generating listener certificates..." diff --git a/gateway/gateway-runtime/Dockerfile b/gateway/gateway-runtime/Dockerfile index b16f207444..85214f4ef3 100644 --- a/gateway/gateway-runtime/Dockerfile +++ b/gateway/gateway-runtime/Dockerfile @@ -210,6 +210,7 @@ COPY router/config/config-override.yaml /etc/envoy/config-override.yaml COPY docker-entrypoint-debug.sh /usr/local/bin/docker-entrypoint.sh COPY health-check.sh /usr/local/bin/health-check.sh COPY --from=target configs/llm-pricing/ /home/wso2/conf/llm-pricing/ +COPY --from=target LICENSE /app/LICENSE RUN chmod +x /app/policy-engine /usr/local/bin/dlv /usr/local/bin/docker-entrypoint.sh /usr/local/bin/health-check.sh @@ -263,6 +264,7 @@ COPY router/config/config-override.yaml /etc/envoy/config-override.yaml COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh COPY health-check.sh /usr/local/bin/health-check.sh COPY --from=target configs/llm-pricing/ /home/wso2/conf/llm-pricing/ +COPY --from=target LICENSE /app/LICENSE RUN chmod +x /app/policy-engine /usr/local/bin/docker-entrypoint.sh /usr/local/bin/health-check.sh diff --git a/gateway/gateway-runtime/Makefile b/gateway/gateway-runtime/Makefile index 24f6bdae53..421513433e 100644 --- a/gateway/gateway-runtime/Makefile +++ b/gateway/gateway-runtime/Makefile @@ -56,7 +56,10 @@ help: ## Show this help message build: test ## Build Gateway Runtime Docker image using buildx @echo "Building Gateway Runtime Docker image ($(IMAGE_NAME):$(VERSION))..." - @mkdir -p target/configs && cp ../build.yaml target/ && cp -r ../configs/llm-pricing target/configs/ + @mkdir -p target/configs + @cp ../build.yaml target/ + @cp ../../LICENSE target/ + @cp -r ../configs/llm-pricing target/configs/ docker buildx build -f Dockerfile \ --build-context sdk=../../sdk \ --build-context sdk-python=../../sdk-python \ @@ -105,7 +108,10 @@ extract-policies: ## Extract controller policy YAMLs from the policy-compiler st build-debug: ## Build debug Gateway Runtime image for remote debugging with dlv (VS Code attach on port 2346) @echo "Building Gateway Runtime debug image ($(IMAGE_NAME)-debug:$(VERSION))..." - @mkdir -p target/configs && cp ../build.yaml target/ && cp -r ../configs/llm-pricing target/configs/ + @mkdir -p target/configs + @cp ../build.yaml target/ + @cp ../../LICENSE target/ + @cp -r ../configs/llm-pricing target/configs/ docker buildx build -f Dockerfile \ --build-context sdk=../../sdk \ --build-context sdk-python=../../sdk-python \ @@ -132,7 +138,10 @@ build-debug: ## Build debug Gateway Runtime image for remote debugging with dlv build-coverage-image: test ## Build Gateway Runtime Docker image with coverage instrumentation @echo "Building Gateway Runtime coverage image ($(IMAGE_NAME)-coverage:$(VERSION))..." - @mkdir -p target/configs && cp ../build.yaml target/ && cp -r ../configs/llm-pricing target/configs/ + @mkdir -p target/configs + @cp ../build.yaml target/ + @cp ../../LICENSE target/ + @cp -r ../configs/llm-pricing target/configs/ DOCKER_BUILDKIT=1 docker build -f Dockerfile \ --build-context sdk=../../sdk \ --build-context sdk-python=../../sdk-python \ @@ -160,7 +169,10 @@ push: ## Push Docker image to registry build-and-push-multiarch: ## Build and push Gateway Runtime Docker image for multiple architectures (amd64, arm64) @echo "Building and pushing multi-arch Gateway Runtime Docker image ($(VERSION))..." - @mkdir -p target/configs && cp ../build.yaml target/ && cp -r ../configs/llm-pricing target/configs/ + @mkdir -p target/configs + @cp ../build.yaml target/ + @cp ../../LICENSE target/ + @cp -r ../configs/llm-pricing target/configs/ docker buildx build -f Dockerfile \ --build-context sdk=../../sdk \ --build-context sdk-python=../../sdk-python \ From 7527b3ab641af1b256bb4c6e63195e080d363fe2 Mon Sep 17 00:00:00 2001 From: Renuka Fernando Date: Thu, 14 May 2026 16:15:54 +0530 Subject: [PATCH 2/2] build: include LICENSE in gateway-builder image Stage the repo-root LICENSE into /app/LICENSE for the gateway-builder image, matching the pattern already used by gateway-runtime, gateway-controller, and event-gateway-runtime. - Add target/ build-context with LICENSE for both build and build-and-push-multiarch targets. - Place at /app/LICENSE (consistent with other images); /workspace is reserved for user policy projects mounted at runtime. - Gitignore the new gateway-builder/target/ directory. --- .gitignore | 1 + gateway/gateway-builder/Dockerfile | 1 + gateway/gateway-builder/Makefile | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/.gitignore b/.gitignore index 4811fae964..595464cb0c 100644 --- a/.gitignore +++ b/.gitignore @@ -142,6 +142,7 @@ platform-api/src/resources/openapi_with_binding.yaml # Gateway gateway/gateway-runtime/target gateway/gateway-controller/target/ +gateway/gateway-builder/target/ event-gateway/gateway-runtime/target/ dev-policies/ diff --git a/gateway/gateway-builder/Dockerfile b/gateway/gateway-builder/Dockerfile index 7901934cbe..3a75ccb5a9 100644 --- a/gateway/gateway-builder/Dockerfile +++ b/gateway/gateway-builder/Dockerfile @@ -97,6 +97,7 @@ COPY --from=system-policies . /api-platform/gateway/system-policies COPY --from=common . /api-platform/common COPY --from=sdk-core . /api-platform/sdk/core COPY --from=sdk-python . /api-platform/sdk-python +COPY --from=target LICENSE /app/LICENSE # Set working directory WORKDIR /workspace diff --git a/gateway/gateway-builder/Makefile b/gateway/gateway-builder/Makefile index 8e2fa01cb6..311d067f9d 100644 --- a/gateway/gateway-builder/Makefile +++ b/gateway/gateway-builder/Makefile @@ -56,6 +56,8 @@ help: ## Show this help message .PHONY: build build: ## Build Docker image using buildx @echo "Building Docker image ($(IMAGE_NAME):$(VERSION))..." + @mkdir -p target + @cp ../../LICENSE target/ @docker buildx build -f Dockerfile \ --build-context policy-engine=../gateway-runtime/policy-engine \ --build-context python-executor=../gateway-runtime/python-executor \ @@ -64,6 +66,7 @@ build: ## Build Docker image using buildx --build-context sdk-core=../../sdk/core \ --build-context sdk-python=../../sdk-python \ --build-context common=../../common \ + --build-context target=target \ --build-arg VERSION=$(VERSION) \ --build-arg GIT_COMMIT=$(GIT_COMMIT) \ -t $(IMAGE_NAME):$(VERSION) \ @@ -81,6 +84,8 @@ push: ## Push Docker image to registry .PHONY: build-and-push-multiarch build-and-push-multiarch: ## Build and push multi-architecture Docker image (linux/amd64, linux/arm64) @echo "Building and pushing multi-arch Docker image: $(IMAGE_NAME):$(VERSION)" + @mkdir -p target + @cp ../../LICENSE target/ docker buildx build -f Dockerfile \ --build-context policy-engine=../gateway-runtime/policy-engine \ --build-context python-executor=../gateway-runtime/python-executor \ @@ -89,6 +94,7 @@ build-and-push-multiarch: ## Build and push multi-architecture Docker image (lin --build-context sdk-core=../../sdk/core \ --build-context sdk-python=../../sdk-python \ --build-context common=../../common \ + --build-context target=target \ --platform linux/amd64,linux/arm64 \ --build-arg VERSION=$(VERSION) \ --build-arg GIT_COMMIT=$(GIT_COMMIT) \