Skip to content
Snippets Groups Projects
Commit 78730184 authored by Jan David Mol's avatar Jan David Mol
Browse files

Merge branch 'L2SS-367-cleanup-containers-on-make-clean' into 'master'

L2SS-367: Cleanup containers on 'make clean', enhance 'make build'

Closes L2SS-367

See merge request !123
parents e084f87c 83eb9399
Branches
Tags
1 merge request!123L2SS-367: Cleanup containers on 'make clean', enhance 'make build'
...@@ -29,6 +29,12 @@ ifeq (start,$(firstword $(MAKECMDGOALS))) ...@@ -29,6 +29,12 @@ ifeq (start,$(firstword $(MAKECMDGOALS)))
SERVICE_TARGET = true SERVICE_TARGET = true
else ifeq (stop,$(firstword $(MAKECMDGOALS))) else ifeq (stop,$(firstword $(MAKECMDGOALS)))
SERVICE_TARGET = true 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))) else ifeq (attach,$(firstword $(MAKECMDGOALS)))
SERVICE_TARGET = true SERVICE_TARGET = true
ifndef NETWORK_MODE ifndef NETWORK_MODE
...@@ -118,7 +124,7 @@ DOCKER_COMPOSE_ARGS := DISPLAY=$(DISPLAY) \ ...@@ -118,7 +124,7 @@ DOCKER_COMPOSE_ARGS := DISPLAY=$(DISPLAY) \
CONTAINER_EXECUTION_UID=$(shell id -u) 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 .DEFAULT_GOAL := help
pull: ## pull the images from the Docker hub pull: ## pull the images from the Docker hub
...@@ -127,7 +133,12 @@ pull: ## pull the images from the Docker hub ...@@ -127,7 +133,12 @@ pull: ## pull the images from the Docker hub
build: ## rebuild images build: ## rebuild images
# docker-compose does not support build dependencies, so manage those here # 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 -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 up: minimal ## start the base TANGO system and prepare all services
$(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) up --no-start $(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) up --no-start
...@@ -152,6 +163,11 @@ start: up ## start a service (usage: make start <servicename>) ...@@ -152,6 +163,11 @@ start: up ## start a service (usage: make start <servicename>)
stop: ## stop a service (usage: make stop <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) 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 attach: ## attach a service to an existing Tango network
$(DOCKER_COMPOSE_ARGS) docker-compose $(ATTACH_COMPOSE_FILE_ARGS) up -d $(SERVICE) $(DOCKER_COMPOSE_ARGS) docker-compose $(ATTACH_COMPOSE_FILE_ARGS) up -d $(SERVICE)
...@@ -162,8 +178,9 @@ status: ## show the container status ...@@ -162,8 +178,9 @@ status: ## show the container status
images: ## show the container images images: ## show the container images
$(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) 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 volume rm $(BASEDIR)_tangodb
$(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) rm -f
help: ## show this help. 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}' @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment