feat: add Makefile for building wasm-go easier (#184)

This commit is contained in:
悟空
2023-02-14 09:59:33 +08:00
committed by GitHub
parent 1b7723bac5
commit cdcfe24a3d
4 changed files with 116 additions and 13 deletions

20
plugins/wasm-go/Makefile Normal file
View File

@@ -0,0 +1,20 @@
PLUGIN_NAME ?= hello-world
REGISTRY ?=
BUILD_TIME := $(shell date "+%Y%m%d-%H%M%S")
COMMIT_ID := $(shell git rev-parse --short HEAD 2>/dev/null)
IMG ?= ${REGISTRY}${PLUGIN_NAME}:${BUILD_TIME}-${COMMIT_ID}
build:
DOCKER_BUILDKIT=1 docker build --build-arg PLUGIN_NAME=${PLUGIN_NAME} \
--build-arg THIS_ARCH=${THIS_ARCH} \
--build-arg GO_VERSION=${GO_VERSION} \
--build-arg TINYGO_VERSION=${TINYGO_VERSION} \
-t ${IMG} \
-f DockerfileBuilder \
--output extensions/${PLUGIN_NAME} .
@echo ""
@echo "image: ${IMG}"
@echo "output wasm file: extensions/${PLUGIN_NAME}/plugin.wasm"
build-push: build
docker push ${IMG}