From 4f479484de0a0b9caae9452eaac96e03c4d478de Mon Sep 17 00:00:00 2001 From: Mike Bonnet Date: Wed, 25 Jun 2025 11:07:42 -0700 Subject: [PATCH] support running all Makefile targets in the bats container Signed-off-by: Mike Bonnet --- Makefile | 18 +++++------------- container-images/bats/Containerfile | 4 ++++ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 2ac8609e..345976db 100644 --- a/Makefile +++ b/Makefile @@ -167,24 +167,16 @@ bats-image: podman inspect $(BATS_IMAGE) &> /dev/null || \ podman build -t $(BATS_IMAGE) -f container-images/bats/Containerfile . -.PHONY: bats-in-container -bats-in-container: bats-image +bats-in-container: extra-opts = --security-opt unmask=/proc/* --device /dev/net/tun + +%-in-container: bats-image podman run -it --rm \ --userns=keep-id:size=200000 \ - --security-opt unmask=/proc/* \ --security-opt label=disable \ --security-opt=mask=/sys/bus/pci/drivers/i915 \ - --device /dev/net/tun \ + $(extra-opts) \ -v $(CURDIR):/src \ - $(BATS_IMAGE) make bats - -.PHONY: bats-nocontainer-in-container -bats-nocontainer-in-container: bats-image - podman run -it --rm \ - --userns=keep-id:size=200000 \ - --security-opt=mask=/sys/bus/pci/drivers/i915 \ - -v $(CURDIR):/src \ - $(BATS_IMAGE) make bats-nocontainer + $(BATS_IMAGE) make $* .PHONY: ci ci: diff --git a/container-images/bats/Containerfile b/container-images/bats/Containerfile index 9066ebab..e55b6403 100644 --- a/container-images/bats/Containerfile +++ b/container-images/bats/Containerfile @@ -8,6 +8,10 @@ ENTRYPOINT ["/usr/bin/entrypoint.sh"] RUN dnf -y install make bats jq iproute podman openssl httpd-tools \ ollama python3-huggingface-hub \ + # for validate and unit-tests + black codespell shellcheck \ + python3-flake8 python3-isort python3-pip python3-pytest \ + perl-Clone perl-FindBin \ # for building llama-bench git-core cmake gcc-c++ curl-devel && \ dnf -y clean all