Skip to content

Commit 248ccfa

Browse files
Merge pull request #1969 from renuka-fernando/licence
build: include LICENSE in gateway and event-gateway images
2 parents e7bb932 + 7527b3a commit 248ccfa

11 files changed

Lines changed: 66 additions & 8 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ platform-api/src/resources/openapi_with_binding.yaml
141141

142142
# Gateway
143143
gateway/gateway-runtime/target
144+
gateway/gateway-controller/target/
145+
gateway/gateway-builder/target/
146+
event-gateway/gateway-runtime/target/
144147
dev-policies/
145148

146149
# Copilot Prompts

event-gateway/Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,24 @@ build: build-event-gateway-controller build-gateway-runtime build-webhook-listen
7373
# once gateway-builder is integrated into the event-gateway build pipeline.
7474
build-event-gateway-controller: ## Build event-gateway-controller Docker image
7575
@echo "Building event-gateway-controller Docker image ($(VERSION))..."
76+
@mkdir -p ../gateway/gateway-controller/target
77+
@cp ../LICENSE ../gateway/gateway-controller/target/
7678
@cd ../gateway/gateway-controller && \
7779
docker buildx build -f Dockerfile \
7880
--build-context sdk=../../sdk \
7981
--build-context sdk-core=../../sdk/core \
8082
--build-context common=../../common \
8183
--build-context build-manifest=.. \
8284
--build-context policies=../../event-gateway/default-policies \
85+
--build-context target=target \
8386
--build-arg VERSION=$(VERSION) \
8487
--build-arg FUNCTIONALITY_TYPE=event \
8588
--build-arg GIT_COMMIT=$$(git rev-parse --short HEAD 2>/dev/null || echo "unknown") \
8689
--target production \
8790
-t $(EVENT_GATEWAY_CONTROLLER_IMAGE):$(VERSION) \
8891
--load \
8992
.
93+
@rm -rf ../gateway/gateway-controller/target
9094

9195
.PHONY: build-gateway-runtime
9296
build-gateway-runtime: ## Build event-gateway-runtime Docker image
@@ -107,13 +111,16 @@ build-and-push-multiarch: build-and-push-multiarch-event-gateway-controller buil
107111
# once gateway-builder is integrated into the event-gateway build pipeline.
108112
build-and-push-multiarch-event-gateway-controller: ## Build and push event-gateway-controller Docker image for multiple architectures
109113
@echo "Building and pushing multi-arch event-gateway-controller Docker image ($(VERSION))..."
114+
@mkdir -p ../gateway/gateway-controller/target
115+
@cp ../LICENSE ../gateway/gateway-controller/target/
110116
@cd ../gateway/gateway-controller && \
111117
docker buildx build -f Dockerfile \
112118
--build-context sdk=../../sdk \
113119
--build-context sdk-core=../../sdk/core \
114120
--build-context common=../../common \
115121
--build-context build-manifest=.. \
116122
--build-context policies=../../event-gateway/default-policies \
123+
--build-context target=target \
117124
--platform linux/amd64,linux/arm64 \
118125
--build-arg VERSION=$(VERSION) \
119126
--build-arg FUNCTIONALITY_TYPE=event \
@@ -122,6 +129,7 @@ build-and-push-multiarch-event-gateway-controller: ## Build and push event-gatew
122129
-t $(EVENT_GATEWAY_CONTROLLER_IMAGE):$(VERSION) \
123130
--push \
124131
.
132+
@rm -rf ../gateway/gateway-controller/target
125133

126134
.PHONY: build-and-push-multiarch-gateway-runtime
127135
build-and-push-multiarch-gateway-runtime: ## Build and push event-gateway-runtime Docker image for multiple architectures

event-gateway/gateway-runtime/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ RUN apk add --no-cache ca-certificates bash tini && \
111111
WORKDIR /app
112112

113113
COPY --from=policy-compiler /api-platform/output/event-gateway/event-gateway /app/event-gateway
114+
COPY --from=target LICENSE /app/LICENSE
114115
COPY configs/config.toml /etc/event-gateway/config.toml
115116
COPY configs/channels.yaml /etc/event-gateway/channels.yaml
116117
COPY docker-entrypoint.sh /app/docker-entrypoint.sh

event-gateway/gateway-runtime/Dockerfile.debug

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ RUN go install github.com/go-delve/delve/cmd/dlv@latest
115115
WORKDIR /app
116116

117117
COPY --from=policy-compiler /api-platform/output/event-gateway/event-gateway /app/event-gateway
118+
COPY --from=target LICENSE /app/LICENSE
118119
COPY configs/config.toml /etc/event-gateway/config.toml
119120
COPY configs/channels.yaml /etc/event-gateway/channels.yaml
120121

event-gateway/gateway-runtime/Makefile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ debug-local: generate ## Build locally with debug symbols and launch Delve on :2
8080
.PHONY: build-docker
8181
build-docker: ## Build Docker image
8282
@echo "Building event-gateway-runtime Docker image ($(VERSION))..."
83-
@mkdir -p target && cp ../build.yaml target/
83+
@mkdir -p target
84+
@cp ../build.yaml target/
85+
@cp ../../LICENSE target/
8486
docker buildx build \
8587
--load \
8688
--platform linux/$(shell uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/') \
@@ -100,7 +102,9 @@ build-docker: ## Build Docker image
100102
.PHONY: build-debug
101103
build-debug: ## Build Docker image with Delve remote debugger (port 2345)
102104
@echo "Building event-gateway-runtime debug Docker image ($(VERSION))..."
103-
@mkdir -p target && cp ../build.yaml target/
105+
@mkdir -p target
106+
@cp ../build.yaml target/
107+
@cp ../../LICENSE target/
104108
docker buildx build \
105109
--load \
106110
--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)
120124
.PHONY: build-and-push-multiarch
121125
build-and-push-multiarch: ## Build and push Docker image for multiple architectures
122126
@echo "Building and pushing multi-arch event-gateway-runtime Docker image ($(VERSION))..."
123-
@mkdir -p target && cp ../build.yaml target/
127+
@mkdir -p target
128+
@cp ../build.yaml target/
129+
@cp ../../LICENSE target/
124130
docker buildx build \
125131
--push \
126132
--platform linux/amd64,linux/arm64 \

gateway/gateway-builder/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ COPY --from=system-policies . /api-platform/gateway/system-policies
9797
COPY --from=common . /api-platform/common
9898
COPY --from=sdk-core . /api-platform/sdk/core
9999
COPY --from=sdk-python . /api-platform/sdk-python
100+
COPY --from=target LICENSE /app/LICENSE
100101

101102
# Set working directory
102103
WORKDIR /workspace

gateway/gateway-builder/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ help: ## Show this help message
5656
.PHONY: build
5757
build: ## Build Docker image using buildx
5858
@echo "Building Docker image ($(IMAGE_NAME):$(VERSION))..."
59+
@mkdir -p target
60+
@cp ../../LICENSE target/
5961
@docker buildx build -f Dockerfile \
6062
--build-context policy-engine=../gateway-runtime/policy-engine \
6163
--build-context python-executor=../gateway-runtime/python-executor \
@@ -64,6 +66,7 @@ build: ## Build Docker image using buildx
6466
--build-context sdk-core=../../sdk/core \
6567
--build-context sdk-python=../../sdk-python \
6668
--build-context common=../../common \
69+
--build-context target=target \
6770
--build-arg VERSION=$(VERSION) \
6871
--build-arg GIT_COMMIT=$(GIT_COMMIT) \
6972
-t $(IMAGE_NAME):$(VERSION) \
@@ -81,6 +84,8 @@ push: ## Push Docker image to registry
8184
.PHONY: build-and-push-multiarch
8285
build-and-push-multiarch: ## Build and push multi-architecture Docker image (linux/amd64, linux/arm64)
8386
@echo "Building and pushing multi-arch Docker image: $(IMAGE_NAME):$(VERSION)"
87+
@mkdir -p target
88+
@cp ../../LICENSE target/
8489
docker buildx build -f Dockerfile \
8590
--build-context policy-engine=../gateway-runtime/policy-engine \
8691
--build-context python-executor=../gateway-runtime/python-executor \
@@ -89,6 +94,7 @@ build-and-push-multiarch: ## Build and push multi-architecture Docker image (lin
8994
--build-context sdk-core=../../sdk/core \
9095
--build-context sdk-python=../../sdk-python \
9196
--build-context common=../../common \
97+
--build-context target=target \
9298
--platform linux/amd64,linux/arm64 \
9399
--build-arg VERSION=$(VERSION) \
94100
--build-arg GIT_COMMIT=$(GIT_COMMIT) \

gateway/gateway-controller/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ RUN --mount=type=cache,target=/go/pkg/mod \
8888
COPY --from=builder /build/controller .
8989
COPY --from=build-manifest build-manifest.yaml /app/build-manifest.yaml
9090
COPY --from=policies . /app/default-policies
91+
COPY --from=target LICENSE /app/LICENSE
9192
COPY lua /app/lua
9293
COPY default-llm-provider-templates /app/default-llm-provider-templates
9394

@@ -117,11 +118,12 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
117118
rm -rf /var/lib/apt/lists/*
118119

119120
WORKDIR /app
120-
# Copy build manifest
121+
# Copy build manifest
121122
COPY --from=build-manifest build-manifest.yaml /app/build-manifest.yaml
122123

123124
COPY --from=builder /build/controller .
124125
COPY --from=policies . /app/default-policies
126+
COPY --from=target LICENSE /app/LICENSE
125127
COPY lua /app/lua
126128
COPY default-llm-provider-templates /app/default-llm-provider-templates
127129

gateway/gateway-controller/Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,15 @@ test: ## Run unit and integration tests
7474

7575
build: generate-server-code test ## Build Docker image using buildx
7676
@echo "Building Docker image ($(IMAGE_NAME):$(VERSION))..."
77+
@mkdir -p target
78+
@cp ../../LICENSE target/
7779
docker buildx build -f Dockerfile \
7880
--build-context sdk=../../sdk \
7981
--build-context sdk-core=../../sdk/core \
8082
--build-context common=../../common \
8183
--build-context build-manifest=.. \
8284
--build-context policies=$(POLICIES_BUILD_CONTEXT) \
85+
--build-context target=target \
8386
--build-arg VERSION=$(VERSION) \
8487
--build-arg FUNCTIONALITY_TYPE=$(FUNCTIONALITY_TYPE) \
8588
--build-arg GIT_COMMIT=$(GIT_COMMIT) \
@@ -88,6 +91,7 @@ build: generate-server-code test ## Build Docker image using buildx
8891
-t $(IMAGE_NAME):latest \
8992
--load \
9093
.
94+
@rm -rf target
9195
@echo "Docker image ($(IMAGE_NAME):$(VERSION)) built successfully."
9296

9397
push: ## Push Docker image to registry
@@ -97,12 +101,15 @@ push: ## Push Docker image to registry
97101

98102
build-and-push-multiarch: ## Build and push multi-architecture Docker image (linux/amd64, linux/arm64)
99103
@echo "Building and pushing multi-arch Docker image: $(IMAGE_NAME):$(VERSION)"
104+
@mkdir -p target
105+
@cp ../../LICENSE target/
100106
docker buildx build -f Dockerfile \
101107
--build-context sdk=../../sdk \
102108
--build-context sdk-core=../../sdk/core \
103109
--build-context common=../../common \
104110
--build-context build-manifest=.. \
105111
--build-context policies=$(POLICIES_BUILD_CONTEXT) \
112+
--build-context target=target \
106113
--platform linux/amd64,linux/arm64 \
107114
--build-arg VERSION=$(VERSION) \
108115
--build-arg FUNCTIONALITY_TYPE=$(FUNCTIONALITY_TYPE) \
@@ -112,14 +119,18 @@ build-and-push-multiarch: ## Build and push multi-architecture Docker image (lin
112119
-t $(IMAGE_NAME):latest \
113120
--push \
114121
.
122+
@rm -rf target
115123

116124
build-coverage-image: test ## Build coverage-instrumented gateway-controller image
125+
@mkdir -p target
126+
@cp ../../LICENSE target/
117127
docker buildx build -f Dockerfile \
118128
--build-context sdk=../../sdk \
119129
--build-context sdk-core=../../sdk/core \
120130
--build-context common=../../common \
121131
--build-context build-manifest=.. \
122132
--build-context policies=$(POLICIES_BUILD_CONTEXT) \
133+
--build-context target=target \
123134
--build-arg VERSION=$(VERSION) \
124135
--build-arg FUNCTIONALITY_TYPE=$(FUNCTIONALITY_TYPE) \
125136
--build-arg GIT_COMMIT=$(GIT_COMMIT) \
@@ -128,14 +139,18 @@ build-coverage-image: test ## Build coverage-instrumented gateway-controller ima
128139
-t $(IMAGE_NAME)-coverage:$(VERSION) \
129140
--load \
130141
.
142+
@rm -rf target
131143

132144
build-debug: ## Build debug image for remote debugging with dlv (VS Code attach on port 2345)
145+
@mkdir -p target
146+
@cp ../../LICENSE target/
133147
docker buildx build -f Dockerfile \
134148
--build-context sdk=../../sdk \
135149
--build-context sdk-core=../../sdk/core \
136150
--build-context common=../../common \
137151
--build-context build-manifest=.. \
138152
--build-context policies=$(POLICIES_BUILD_CONTEXT) \
153+
--build-context target=target \
139154
--build-arg VERSION=$(VERSION) \
140155
--build-arg FUNCTIONALITY_TYPE=$(FUNCTIONALITY_TYPE) \
141156
--build-arg GIT_COMMIT=$(GIT_COMMIT) \
@@ -145,6 +160,7 @@ build-debug: ## Build debug image for remote debugging with dlv (VS Code attach
145160
-t $(IMAGE_NAME)-debug:latest \
146161
--load \
147162
.
163+
@rm -rf target
148164

149165
generate-listener-certs: ## Generate listener certificates
150166
@echo "Generating listener certificates..."

gateway/gateway-runtime/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ COPY router/config/config-override.yaml /etc/envoy/config-override.yaml
210210
COPY docker-entrypoint-debug.sh /usr/local/bin/docker-entrypoint.sh
211211
COPY health-check.sh /usr/local/bin/health-check.sh
212212
COPY --from=target configs/llm-pricing/ /home/wso2/conf/llm-pricing/
213+
COPY --from=target LICENSE /app/LICENSE
213214

214215
RUN chmod +x /app/policy-engine /usr/local/bin/dlv /usr/local/bin/docker-entrypoint.sh /usr/local/bin/health-check.sh
215216

@@ -263,6 +264,7 @@ COPY router/config/config-override.yaml /etc/envoy/config-override.yaml
263264
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
264265
COPY health-check.sh /usr/local/bin/health-check.sh
265266
COPY --from=target configs/llm-pricing/ /home/wso2/conf/llm-pricing/
267+
COPY --from=target LICENSE /app/LICENSE
266268

267269
RUN chmod +x /app/policy-engine /usr/local/bin/docker-entrypoint.sh /usr/local/bin/health-check.sh
268270

0 commit comments

Comments
 (0)