diff --git a/Makefile b/Makefile index fd116826..ff8f7daa 100644 --- a/Makefile +++ b/Makefile @@ -21,10 +21,6 @@ DOCKER_SOCK ?= /var/run/docker.sock DOCKER_SOCKS := -v $(PODMAN_SOCK):$(PODMAN_SOCK):ro -v $(DOCKER_SOCK):$(DOCKER_SOCK):ro DOCKER_OPTS := --rm -e TZ="${TZ}" -e GLANCES_OPT="" --pid host --network host -define DOCKER_TAG -glances:local-$* -endef - # if the command is only `make`, the default tasks will be the printing of the help. .DEFAULT_GOAL := help @@ -224,16 +220,12 @@ snapcraft: # Need Docker Buildx package (apt install docker-buildx on Ubuntu) # =================================================================== -define DOCKERFILE -docker-files/$(word 1,$(subst -, ,$*)).Dockerfile +define MAKE_DOCKER_BUILD_RULES +$($(DISTRO)_images): docker-$(DISTRO)-%: docker-files/$(DISTRO).Dockerfile + $(DOCKER_BUILD) --target $$* -f $$< -t glances:local-$(DISTRO)-$$* . endef -define TARGET -$(word 2,$(subst -, ,$*)) -endef - -$(DOCKER_IMAGES): docker-%: - $(DOCKER_BUILD) --target $(TARGET) -f $(DOCKERFILE) -t $(DOCKER_TAG) . +$(foreach DISTRO,$(DISTROS),$(eval $(MAKE_DOCKER_BUILD_RULES))) docker: docker-alpine docker-ubuntu ## Generate local docker images @@ -273,7 +265,7 @@ run-min-local-conf: ## Start minimal Glances in console mode with the system con $(VENV_MIN)/python -m glances $(DOCKER_RUNTIMES): run-docker-%: - $(DOCKER_RUN) $(DOCKER_OPTS) $(DOCKER_SOCKS) -it $(DOCKER_TAG) + $(DOCKER_RUN) $(DOCKER_OPTS) $(DOCKER_SOCKS) -it glances:local-$* run-docker-alpine-minimal: ## Start Glances Alpine Docker minimal in console mode run-docker-alpine-full: ## Start Glances Alpine Docker full in console mode