Skip to content

Commit 4f47948

Browse files
committed
support running all Makefile targets in the bats container
Signed-off-by: Mike Bonnet <[email protected]>
1 parent a651be7 commit 4f47948

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

Makefile

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -167,24 +167,16 @@ bats-image:
167167
podman inspect $(BATS_IMAGE) &> /dev/null || \
168168
podman build -t $(BATS_IMAGE) -f container-images/bats/Containerfile .
169169

170-
.PHONY: bats-in-container
171-
bats-in-container: bats-image
172-
podman run -it --rm \
173-
--userns=keep-id:size=200000 \
174-
--security-opt unmask=/proc/* \
175-
--security-opt label=disable \
176-
--security-opt=mask=/sys/bus/pci/drivers/i915 \
177-
--device /dev/net/tun \
178-
-v $(CURDIR):/src \
179-
$(BATS_IMAGE) make bats
170+
bats-in-container: extra-opts = --security-opt unmask=/proc/* --device /dev/net/tun
180171

181-
.PHONY: bats-nocontainer-in-container
182-
bats-nocontainer-in-container: bats-image
172+
%-in-container: bats-image
183173
podman run -it --rm \
184174
--userns=keep-id:size=200000 \
175+
--security-opt label=disable \
185176
--security-opt=mask=/sys/bus/pci/drivers/i915 \
177+
$(extra-opts) \
186178
-v $(CURDIR):/src \
187-
$(BATS_IMAGE) make bats-nocontainer
179+
$(BATS_IMAGE) make $*
188180

189181
.PHONY: ci
190182
ci:

container-images/bats/Containerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ ENTRYPOINT ["/usr/bin/entrypoint.sh"]
88

99
RUN dnf -y install make bats jq iproute podman openssl httpd-tools \
1010
ollama python3-huggingface-hub \
11+
# for validate and unit-tests
12+
black codespell shellcheck \
13+
python3-flake8 python3-isort python3-pip python3-pytest \
14+
perl-Clone perl-FindBin \
1115
# for building llama-bench
1216
git-core cmake gcc-c++ curl-devel && \
1317
dnf -y clean all

0 commit comments

Comments
 (0)