@@ -5,6 +5,7 @@ GO_COMPONENT_NAME := service.wasm
55SERVER_COMPONENT_PATH := $(ROOT_DIR ) /app-js/$(SERVER_COMPONENT_NAME )
66GO_COMPONENT_PATH := $(ROOT_DIR ) /service-go/$(GO_COMPONENT_NAME )
77COMPOSED_COMPONENT_PATH := $(ROOT_DIR ) /composed.wasm
8+ COMPOSED_COMPILED_COMPONENT_PATH := $(ROOT_DIR ) /composed.cwasm
89.DEFAULT_GOAL: =help
910
1011# # --------------------------------------
@@ -31,11 +32,12 @@ build-compose: ## Compose the microservice app with the constituent components.
3132 $(info "Fusing components together with wac...")
3233 # @wac plug --plug $(GO_COMPONENT_PATH) -o composed.wasm $(SERVER_COMPONENT_PATH)
3334 wac compose --dep example:service=$(GO_COMPONENT_PATH ) --dep example:server=$(SERVER_COMPONENT_PATH ) -o composed.wasm compose.wac
35+ wasmtime compile $(COMPOSED_COMPONENT_PATH )
3436
3537.PHONY : run
3638run : # # Run the microservice app after build.
3739 $(info "Running Component Application Using Wasmtime...")
38- wasmtime serve -S cli --env OPENAI_API_KEY= " $$ {OPENAI_API_KEY} " $( COMPOSED_COMPONENT_PATH )
40+ wasmtime serve -S cli --env OPENAI_API_KEY --allow-precompiled $( COMPOSED_COMPILED_COMPONENT_PATH )
3941
4042.PHONY : build-and-run
4143build-and-run : build run # # Build and run the microservice app.
@@ -45,7 +47,7 @@ build-and-run: build run ## Build and run the microservice app.
4547.PHONY : clean
4648clean : # # Clean up the build artifacts.
4749 @echo " Cleaning up build artifacts..."
48- @rm -rf $(SERVER_COMPONENT_PATH ) $(GO_COMPONENT_PATH ) $(COMPOSED_COMPONENT_PATH )
50+ @rm -rf $(SERVER_COMPONENT_PATH ) $(GO_COMPONENT_PATH ) $(COMPOSED_COMPONENT_PATH ) $( COMPOSED_COMPILED_COMPONENT_PATH )
4951
5052help : # # Display this help.
5153 @awk ' BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[0-9a-zA-Z_-]+:.*?##/ { printf " \033[36m%-25s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST )
0 commit comments