mirror of
https://github.com/nicolargo/glances.git
synced 2024-11-23 20:45:33 +03:00
Rules targetting docker-*
are now built at runtime
* removed the macros `DOCKERFILE`, `TARGET`, & `DOCKER_TAG` * introduced the macro `MAKE_DOCKER_BUILD_RULES` * at runtime, `docker-*` are built from the `DISTROS` list: done using `eval` [1] * `make help` is unchanged: ``` $ make | grep '\sdocker-' make docker-alpine Generate local docker images (Alpine) make docker-alpine-dev Generate local docker image (Alpine dev) make docker-alpine-full Generate local docker image (Alpine full) make docker-alpine-minimal Generate local docker image (Alpine minimal) make docker-ubuntu Generate local docker images (Ubuntu) make docker-ubuntu-dev Generate local docker image (Ubuntu dev) make docker-ubuntu-full Generate local docker image (Ubuntu full) make docker-ubuntu-minimal Generate local docker image (Ubuntu minimal) $ make docker -n docker buildx build --target full -f docker-files/alpine.Dockerfile -t glances:local-alpine-full . docker buildx build --target minimal -f docker-files/alpine.Dockerfile -t glances:local-alpine-minimal . docker buildx build --target dev -f docker-files/alpine.Dockerfile -t glances:local-alpine-dev . docker buildx build --target full -f docker-files/ubuntu.Dockerfile -t glances:local-ubuntu-full . docker buildx build --target minimal -f docker-files/ubuntu.Dockerfile -t glances:local-ubuntu-minimal . docker buildx build --target dev -f docker-files/ubuntu.Dockerfile -t glances:local-ubuntu-dev . ``` [1] https://www.gnu.org/software/make/manual/html_node/Eval-Function.html Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
This commit is contained in:
parent
ddfcf46dee
commit
a37010929d
18
Makefile
18
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
|
||||
|
Loading…
Reference in New Issue
Block a user