From 1f3ffa88818888da182eb35f5f18c2c9103ad392 Mon Sep 17 00:00:00 2001 From: abel <67806187+theo-abel@users.noreply.github.com> Date: Mon, 9 Mar 2026 16:59:31 +0100 Subject: [PATCH] build(makefile): improve build-modules Build the fuzzforge-modules-sdk wheel and image and derive SDK_VERSION from pyproject.toml to use as the base image for other module builds (passed via --build-arg BASE_IMAGE). Set BASE_IMG_PREFIX to "localhost/" when using Podman so local images are referenced correctly. Streamline module loop to skip the SDK dir, require a Dockerfile, preserve existing "fuzzforge-*" names, and consistently tag images as fuzzforge-: --- Makefile | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index a5ebc7e..9368534 100644 --- a/Makefile +++ b/Makefile @@ -76,19 +76,30 @@ build-modules: echo "Using Podman"; \ CONTAINER_CMD="podman"; \ fi; \ + BASE_IMG_PREFIX="localhost/"; \ else \ echo "Using Docker"; \ CONTAINER_CMD="docker"; \ + BASE_IMG_PREFIX=""; \ fi; \ + SDK_DIR="fuzzforge-modules/fuzzforge-modules-sdk/"; \ + SDK_VERSION=$$(grep 'version' "$${SDK_DIR}pyproject.toml" 2>/dev/null | head -1 | sed 's/version = //;s/"//g' || echo "0.0.1"); \ + echo "Building wheels for fuzzforge-modules-sdk..."; \ + (cd "$$SDK_DIR" && uv build --wheel --out-dir .wheels) || exit 1; \ + echo "Building fuzzforge-modules-sdk:$$SDK_VERSION..."; \ + $$CONTAINER_CMD build -t "fuzzforge-modules-sdk:$$SDK_VERSION" "$$SDK_DIR" || exit 1; \ for module in fuzzforge-modules/*/; do \ - if [ -f "$$module/Dockerfile" ] && \ - [ "$$module" != "fuzzforge-modules/fuzzforge-modules-sdk/" ] && \ - [ "$$module" != "fuzzforge-modules/fuzzforge-module-template/" ]; then \ - name=$$(basename $$module); \ - version=$$(grep 'version' "$$module/pyproject.toml" 2>/dev/null | head -1 | sed 's/.*"\(.*\\)".*/\\1/' || echo "0.1.0"); \ - echo "Building $$name:$$version..."; \ - $$CONTAINER_CMD build -t "fuzzforge-$$name:$$version" "$$module" || exit 1; \ - fi \ + [ "$$module" = "$$SDK_DIR" ] || [ ! -f "$$module/Dockerfile" ] && continue; \ + name=$$(basename $$module); \ + version=$$(grep 'version' "$$module/pyproject.toml" 2>/dev/null | head -1 | sed 's/version = //;s/"//g'); \ + case $$name in \ + fuzzforge-*) tag="$$name:$$version" ;; \ + *) tag="fuzzforge-$$name:$$version" ;; \ + esac; \ + echo "Building $$tag..."; \ + $$CONTAINER_CMD build \ + --build-arg BASE_IMAGE="$${BASE_IMG_PREFIX}fuzzforge-modules-sdk:$$SDK_VERSION" \ + -t "$$tag" "$$module" || exit 1; \ done @echo "" @echo "✓ All modules built successfully!"