This is an automated email from the ASF dual-hosted git repository.
baoyuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git
The following commit(s) were added to refs/heads/master by this push:
new b1d6ad516 fix(ci): limit JVM heap for CI containers and replace pack
with docker build (#13157)
b1d6ad516 is described below
commit b1d6ad516916e510ccab7d5c5049fa0aaab09f39
Author: Shreemaan Abhishek <[email protected]>
AuthorDate: Wed Apr 8 15:52:15 2026 +0545
fix(ci): limit JVM heap for CI containers and replace pack with docker
build (#13157)
---
ci/pod/docker-compose.plugin.yml | 17 ++++++++++
ci/pod/openfunction/build-function-image.sh | 11 +++----
.../function-example/test-body/Dockerfile | 30 ++++++++++++++++++
.../function-example/test-body/cmd/main.go | 36 ++++++++++++++++++++++
.../function-example/test-header/Dockerfile | 29 +++++++++++++++++
.../function-example/test-header/cmd/main.go | 30 ++++++++++++++++++
.../function-example/test-uri/Dockerfile | 30 ++++++++++++++++++
.../function-example/test-uri/cmd/main.go | 36 ++++++++++++++++++++++
8 files changed, 212 insertions(+), 7 deletions(-)
diff --git a/ci/pod/docker-compose.plugin.yml b/ci/pod/docker-compose.plugin.yml
index a0923fd67..0cecf593f 100644
--- a/ci/pod/docker-compose.plugin.yml
+++ b/ci/pod/docker-compose.plugin.yml
@@ -45,6 +45,8 @@ services:
image: bitnamilegacy/zookeeper:3.6.0
env_file:
- ci/pod/kafka/zookeeper-server/env/common.env
+ environment:
+ JVMFLAGS: "-Xms64m -Xmx128m"
restart: unless-stopped
ports:
- "2181:2181"
@@ -55,6 +57,8 @@ services:
image: bitnamilegacy/zookeeper:3.6.0
env_file:
- ci/pod/kafka/zookeeper-server/env/common.env
+ environment:
+ JVMFLAGS: "-Xms64m -Xmx128m"
restart: unless-stopped
ports:
- "12181:12181"
@@ -65,6 +69,8 @@ services:
image: bitnamilegacy/zookeeper:3.6.0
env_file:
- ci/pod/kafka/zookeeper-server/env/common.env
+ environment:
+ JVMFLAGS: "-Xms64m -Xmx128m"
restart: unless-stopped
ports:
- "12182:12181"
@@ -77,6 +83,7 @@ services:
- ci/pod/kafka/kafka-server/env/common.env
environment:
KAFKA_CFG_ZOOKEEPER_CONNECT: zookeeper-server1:2181
+ KAFKA_HEAP_OPTS: "-Xms256m -Xmx256m"
restart: unless-stopped
ports:
- "9092:9092"
@@ -92,6 +99,7 @@ services:
- ci/pod/kafka/kafka-server/env/common2.env
environment:
KAFKA_CFG_ZOOKEEPER_CONNECT: zookeeper-server2:2181
+ KAFKA_HEAP_OPTS: "-Xms256m -Xmx256m"
restart: unless-stopped
ports:
- "19092:19092"
@@ -110,6 +118,7 @@ services:
- ci/pod/kafka/kafka-server/env/common3-scram.env
environment:
KAFKA_CFG_ZOOKEEPER_CONNECT: zookeeper-server3:2181
+ KAFKA_HEAP_OPTS: "-Xms256m -Xmx256m"
restart: unless-stopped
ports:
- "29092:29092" # PLAINTEXT for inter-broker communication
@@ -126,6 +135,8 @@ services:
## SkyWalking
skywalking:
image: apache/skywalking-oap-server:8.7.0-es6
+ environment:
+ JAVA_OPTS: "-Xms128m -Xmx256m"
restart: unless-stopped
ports:
- "1234:1234"
@@ -166,6 +177,8 @@ services:
rocketmq_namesrv:
image: apacherocketmq/rocketmq:4.6.0
container_name: rmqnamesrv
+ environment:
+ JAVA_OPT_EXT: "-Xms128m -Xmx128m -Xmn64m"
restart: unless-stopped
ports:
- "9876:9876"
@@ -176,6 +189,8 @@ services:
rocketmq_broker:
image: apacherocketmq/rocketmq:4.6.0
container_name: rmqbroker
+ environment:
+ JAVA_OPT_EXT: "-Xms256m -Xmx256m -Xmn128m"
restart: unless-stopped
ports:
- "10909:10909"
@@ -356,6 +371,8 @@ services:
graphql-demo:
# the owner doesn't provide a semver tag
image: npalm/graphql-java-demo:latest
+ environment:
+ _JAVA_OPTIONS: "-Xms128m -Xmx256m"
ports:
- '8888:8080'
diff --git a/ci/pod/openfunction/build-function-image.sh
b/ci/pod/openfunction/build-function-image.sh
index dc9f34a8b..468c01920 100755
--- a/ci/pod/openfunction/build-function-image.sh
+++ b/ci/pod/openfunction/build-function-image.sh
@@ -17,12 +17,9 @@
#
set -xeuo pipefail
-if [ ! -f "./pack" ]; then
- wget -q
https://github.com/buildpacks/pack/releases/download/v0.27.0/pack-v0.27.0-linux.tgz
- tar -zxvf pack-v0.27.0-linux.tgz
-fi
+SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
# please update function-example/*/hello.go if you want to update function
-./pack build test-uri-image --path
./ci/pod/openfunction/function-example/test-uri --builder
openfunction/builder-go:v2.4.0-1.17 --env FUNC_NAME="HelloWorld" --env
FUNC_CLEAR_SOURCE=true --env FUNC_GOPROXY="https://proxy.golang.org"
-./pack build test-body-image --path
./ci/pod/openfunction/function-example/test-body --builder
openfunction/builder-go:v2.4.0-1.17 --env FUNC_NAME="HelloWorld" --env
FUNC_CLEAR_SOURCE=true --env FUNC_GOPROXY="https://proxy.golang.org"
-./pack build test-header-image --path
./ci/pod/openfunction/function-example/test-header --builder
openfunction/builder-go:v2.4.0-1.17 --env FUNC_NAME="HelloWorld" --env
FUNC_CLEAR_SOURCE=true --env FUNC_GOPROXY="https://proxy.golang.org"
+docker build -t test-uri-image "$SCRIPT_DIR/function-example/test-uri"
+docker build -t test-body-image "$SCRIPT_DIR/function-example/test-body"
+docker build -t test-header-image "$SCRIPT_DIR/function-example/test-header"
diff --git a/ci/pod/openfunction/function-example/test-body/Dockerfile
b/ci/pod/openfunction/function-example/test-body/Dockerfile
new file mode 100644
index 000000000..1a1d9b1ac
--- /dev/null
+++ b/ci/pod/openfunction/function-example/test-body/Dockerfile
@@ -0,0 +1,30 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+FROM golang:1.24 AS builder
+WORKDIR /workspace
+COPY . .
+RUN CGO_ENABLED=0 go build -mod=mod -o /server ./cmd/
+
+FROM ubuntu:20.04
+RUN groupadd -r app && useradd -r -g app -m app
+COPY --from=builder /server /server
+RUN chown app:app /server
+USER app
+ENV FUNC_NAME=HelloWorld
+EXPOSE 8080
+ENTRYPOINT ["/server"]
diff --git a/ci/pod/openfunction/function-example/test-body/cmd/main.go
b/ci/pod/openfunction/function-example/test-body/cmd/main.go
new file mode 100644
index 000000000..59cf2d50f
--- /dev/null
+++ b/ci/pod/openfunction/function-example/test-body/cmd/main.go
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package main
+
+import (
+ "context"
+ "log"
+
+ _ "example.com/hello"
+ "github.com/OpenFunction/functions-framework-go/framework"
+)
+
+func main() {
+ fwk, err := framework.NewFramework()
+ if err != nil {
+ log.Fatalf("failed to create framework: %v", err)
+ }
+ if err = fwk.Start(context.Background()); err != nil {
+ log.Fatalf("failed to start framework: %v", err)
+ }
+}
diff --git a/ci/pod/openfunction/function-example/test-header/Dockerfile
b/ci/pod/openfunction/function-example/test-header/Dockerfile
new file mode 100644
index 000000000..7d4f112f4
--- /dev/null
+++ b/ci/pod/openfunction/function-example/test-header/Dockerfile
@@ -0,0 +1,29 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+FROM golang:1.24 AS builder
+WORKDIR /workspace
+COPY . .
+RUN CGO_ENABLED=0 go build -mod=mod -o /server ./cmd/
+
+FROM ubuntu:20.04
+RUN groupadd -r app && useradd -r -g app -m app
+COPY --from=builder /server /server
+RUN chown app:app /server
+USER app
+EXPOSE 8080
+ENTRYPOINT ["/server"]
diff --git a/ci/pod/openfunction/function-example/test-header/cmd/main.go
b/ci/pod/openfunction/function-example/test-header/cmd/main.go
new file mode 100644
index 000000000..e752085f3
--- /dev/null
+++ b/ci/pod/openfunction/function-example/test-header/cmd/main.go
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package main
+
+import (
+ "log"
+ "net/http"
+
+ hello "example.com/hello"
+)
+
+func main() {
+ http.HandleFunc("/", hello.HelloWorld)
+ log.Fatal(http.ListenAndServe(":8080", nil))
+}
diff --git a/ci/pod/openfunction/function-example/test-uri/Dockerfile
b/ci/pod/openfunction/function-example/test-uri/Dockerfile
new file mode 100644
index 000000000..1a1d9b1ac
--- /dev/null
+++ b/ci/pod/openfunction/function-example/test-uri/Dockerfile
@@ -0,0 +1,30 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+FROM golang:1.24 AS builder
+WORKDIR /workspace
+COPY . .
+RUN CGO_ENABLED=0 go build -mod=mod -o /server ./cmd/
+
+FROM ubuntu:20.04
+RUN groupadd -r app && useradd -r -g app -m app
+COPY --from=builder /server /server
+RUN chown app:app /server
+USER app
+ENV FUNC_NAME=HelloWorld
+EXPOSE 8080
+ENTRYPOINT ["/server"]
diff --git a/ci/pod/openfunction/function-example/test-uri/cmd/main.go
b/ci/pod/openfunction/function-example/test-uri/cmd/main.go
new file mode 100644
index 000000000..59cf2d50f
--- /dev/null
+++ b/ci/pod/openfunction/function-example/test-uri/cmd/main.go
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package main
+
+import (
+ "context"
+ "log"
+
+ _ "example.com/hello"
+ "github.com/OpenFunction/functions-framework-go/framework"
+)
+
+func main() {
+ fwk, err := framework.NewFramework()
+ if err != nil {
+ log.Fatalf("failed to create framework: %v", err)
+ }
+ if err = fwk.Start(context.Background()); err != nil {
+ log.Fatalf("failed to start framework: %v", err)
+ }
+}