feat: 使用多阶段构建优化 wasm-go 构建流程 (#192)

This commit is contained in:
悟空
2023-02-24 12:26:31 +08:00
committed by GitHub
parent e839052a9e
commit bd381b3536
5 changed files with 179 additions and 72 deletions

View File

@@ -1,2 +1,17 @@
FROM scratch
COPY main.wasm plugin.wasm
ARG BUILDER=higress-registry.cn-hangzhou.cr.aliyuncs.com/plugins/wasm-go-builder:go1.19-tinygo0.26.0
FROM $BUILDER as builder
ARG PLUGIN_NAME=hello-world
WORKDIR /workspace
COPY . .
WORKDIR /workspace/extensions/$PLUGIN_NAME
RUN go mod tidy
RUN tinygo build -o /main.wasm -scheduler=none -target=wasi ./main.go
FROM scratch as output
COPY --from=builder /main.wasm plugin.wasm