- Makefile: introduce CONTAINER_CMD ?= $(shell command -v docker || echo podman), replace all 12 hardcoded `docker` invocations with $(CONTAINER_CMD). User can override with `make <target> CONTAINER_CMD=podman` or env export. - e2e/tests/us1-bootstrap-admin.spec.ts: AC-1.4 regex updated to match the new variable form `$(CONTAINER_CMD) exec … flask create-admin` (was hardcoded `docker exec`). RUNTIME default also auto-detects (same logic as Makefile) so the test exec'es the right engine without a MIMIC_CONTAINER_CMD export. - e2e/tests/us6-deployment.spec.ts: same RUNTIME auto-detect so the make-dry-run regex assertions on lines 75 + 77 match what the Makefile actually emits on a podman-only host. - README + CHANGELOG document the new behavior. Fixes the user-reported issue: "Le makefile ne fonctionne pas sur ma machine qui n'a que podman." Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
63 lines
1.9 KiB
Makefile
63 lines
1.9 KiB
Makefile
PORT ?= 5000
|
|
IMAGE ?= mimic:latest
|
|
CONTAINER ?= mimic
|
|
VOLUME ?= mimic-data
|
|
|
|
# Container engine: auto-detect docker first, fall back to podman.
|
|
# Override explicitly with `make <target> CONTAINER_CMD=podman` or `export CONTAINER_CMD=podman`.
|
|
CONTAINER_CMD ?= $(shell if command -v docker >/dev/null 2>&1; then echo docker; else echo podman; fi)
|
|
|
|
.PHONY: build start stop restart update logs create-admin update-mitre test-backend test-frontend test-e2e clean
|
|
|
|
build:
|
|
$(CONTAINER_CMD) build -f docker/Dockerfile -t $(IMAGE) .
|
|
|
|
start:
|
|
$(CONTAINER_CMD) run -d --name $(CONTAINER) -p $(PORT):5000 -v $(VOLUME):/data --env-file .env $(IMAGE)
|
|
|
|
stop:
|
|
$(CONTAINER_CMD) stop $(CONTAINER) && $(CONTAINER_CMD) rm $(CONTAINER)
|
|
|
|
restart:
|
|
$(MAKE) stop && $(MAKE) start
|
|
|
|
update:
|
|
git pull && $(MAKE) build && $(MAKE) restart
|
|
|
|
logs:
|
|
$(CONTAINER_CMD) logs -f $(CONTAINER)
|
|
|
|
create-admin:
|
|
ifndef USER
|
|
$(error USER is required: make create-admin USER=alice PASS=p4ssw0rd)
|
|
endif
|
|
ifndef PASS
|
|
$(error PASS is required: make create-admin USER=alice PASS=p4ssw0rd)
|
|
endif
|
|
$(CONTAINER_CMD) exec $(CONTAINER) flask create-admin $(USER) $(PASS)
|
|
|
|
MITRE_URL ?= https://raw.githubusercontent.com/mitre/cti/master/enterprise-attack/enterprise-attack.json
|
|
|
|
update-mitre:
|
|
@mkdir -p backend/data/mitre
|
|
@curl -fsSL "$(MITRE_URL)" -o backend/data/mitre/enterprise-attack.json
|
|
@echo "MITRE bundle updated"
|
|
@if $(CONTAINER_CMD) ps --format '{{.Names}}' | grep -q "^$(CONTAINER)$$"; then \
|
|
echo "Restarting $(CONTAINER) to reload MITRE bundle..."; \
|
|
$(CONTAINER_CMD) restart $(CONTAINER); \
|
|
fi
|
|
|
|
test-backend:
|
|
$(CONTAINER_CMD) exec $(CONTAINER) pytest -q backend/tests/
|
|
|
|
test-frontend:
|
|
cd frontend && npm run test -- --run
|
|
|
|
test-e2e:
|
|
cd e2e && npx playwright test
|
|
|
|
clean:
|
|
-$(CONTAINER_CMD) rm -f $(CONTAINER) 2>/dev/null
|
|
-$(CONTAINER_CMD) volume rm $(VOLUME) 2>/dev/null
|
|
rm -rf backend/__pycache__ frontend/node_modules frontend/dist
|