diff --git a/docker-compose/Makefile b/docker-compose/Makefile index 09eb760123bc4687207609c3ad94c740a72c317c..686f88f9e4887039cbe5206a5a88ecb8df9aed8c 100644 --- a/docker-compose/Makefile +++ b/docker-compose/Makefile @@ -29,6 +29,12 @@ ifeq (start,$(firstword $(MAKECMDGOALS))) SERVICE_TARGET = true else ifeq (stop,$(firstword $(MAKECMDGOALS))) SERVICE_TARGET = true +else ifeq (restart,$(firstword $(MAKECMDGOALS))) + SERVICE_TARGET = true +else ifeq (build,$(firstword $(MAKECMDGOALS))) + SERVICE_TARGET = true +else ifeq (build-nocache,$(firstword $(MAKECMDGOALS))) + SERVICE_TARGET = true else ifeq (attach,$(firstword $(MAKECMDGOALS))) SERVICE_TARGET = true ifndef NETWORK_MODE @@ -118,7 +124,7 @@ DOCKER_COMPOSE_ARGS := DISPLAY=$(DISPLAY) \ CONTAINER_EXECUTION_UID=$(shell id -u) -.PHONY: up down minimal start stop status clean pull help +.PHONY: up down minimal start stop restart build build-nocache status clean pull help .DEFAULT_GOAL := help pull: ## pull the images from the Docker hub @@ -127,7 +133,12 @@ pull: ## pull the images from the Docker hub build: ## rebuild images # docker-compose does not support build dependencies, so manage those here $(DOCKER_COMPOSE_ARGS) docker-compose -f lofar-device-base.yml -f networks.yml build - $(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) build + $(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) build $(SERVICE) + +build-nocache: ## rebuild images from scratch + # docker-compose does not support build dependencies, so manage those here + $(DOCKER_COMPOSE_ARGS) docker-compose -f lofar-device-base.yml -f networks.yml build + $(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) build --no-cache $(SERVICE) up: minimal ## start the base TANGO system and prepare all services $(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) up --no-start @@ -152,6 +163,11 @@ start: up ## start a service (usage: make start <servicename>) stop: ## stop a service (usage: make stop <servicename>) $(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) stop $(SERVICE) + $(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) rm -f $(SERVICE) + +restart: ## restart a service (usage: make restart <servicename>) + make stop $(SERVICE) # cannot use dependencies, as that would allow start and stop to run in parallel.. + make start $(SERVICE) attach: ## attach a service to an existing Tango network $(DOCKER_COMPOSE_ARGS) docker-compose $(ATTACH_COMPOSE_FILE_ARGS) up -d $(SERVICE) @@ -162,8 +178,9 @@ status: ## show the container status images: ## show the container images $(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) images -clean: down ## clear all TANGO database entries +clean: down ## clear all TANGO database entries, and all containers docker volume rm $(BASEDIR)_tangodb + $(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) rm -f help: ## show this help. @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'