From 7cf0dae824cf4f2bf157b8c95193bccfecbc3f98 Mon Sep 17 00:00:00 2001 From: Kent Dong Date: Tue, 15 Apr 2025 10:25:59 +0800 Subject: [PATCH] feat: Support building waf plugin using Makefile (#2061) --- plugins/wasm-go/Dockerfile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/wasm-go/Dockerfile b/plugins/wasm-go/Dockerfile index 903e60178..6b483aaa0 100644 --- a/plugins/wasm-go/Dockerfile +++ b/plugins/wasm-go/Dockerfile @@ -17,7 +17,14 @@ COPY . . WORKDIR /workspace/extensions/$PLUGIN_NAME RUN go mod tidy -RUN tinygo build -o /main.wasm -scheduler=none -gc=custom -tags="custommalloc nottinygc_finalizer $EXTRA_TAGS" -target=wasi ./ +RUN \ + if echo "$PLUGIN_NAME" | grep -Eq '^waf$'; then \ + # Please use higress-registry.cn-hangzhou.cr.aliyuncs.com/plugins/wasm-go-builder:go1.19-tinygo0.28.1-oras1.0.0 as BUILDER + go run mage.go build && \ + mv ./local/main.wasm /main.wasm ; \ + else \ + tinygo build -o /main.wasm -scheduler=none -gc=custom -tags="custommalloc nottinygc_finalizer $EXTRA_TAGS" -target=wasi ./ ; \ + fi FROM scratch as output