chore
[mbt-docker.git] / Makefile
CommitLineData
482fe6a2 1PROJECT_NAME?=sap-e-mobility
8772b2e0 2NAME:=mbt-docker
482fe6a2
JB
3SUBMODULES_INIT?=false
4DOCKER_REGISTRY_USERNAME?=fraggle0
5DOCKER_REGISTRY_PASSWORD?=
6DOCKER_REGISTRY_NAME?=$(NAME)
7DOCKER_REGISTRY_TAG?=latest
8
9.PHONY: all
10
11default: all
12
13submodule-update:
14 git submodule update --init --recursive
15
16submodules-init=
17ifeq '$(SUBMODULES_INIT)' 'true'
18 submodules-init += submodule-update
19endif
20
21$(NAME): $(submodules-init)
22 docker-compose -p $(PROJECT_NAME) up -d
23
24$(NAME)-force: $(submodules-init)
25 docker-compose -p $(PROJECT_NAME) up -d --build --force-recreate
26
27all: $(NAME)
28
29clean-images:
30 -docker rmi $(PROJECT_NAME)-$(NAME)
31
32clean-containers:
33 -docker-compose -p $(PROJECT_NAME) down
34
35clean: clean-containers clean-images
36
37docker-tag-registry:
38 docker tag $(PROJECT_NAME)-$(NAME) $(DOCKER_REGISTRY_USERNAME)/$(DOCKER_REGISTRY_NAME):$(DOCKER_REGISTRY_TAG)
39
40docker-login-registry:
41 -docker login -u '$(DOCKER_REGISTRY_USERNAME)' -p '$(DOCKER_REGISTRY_PASSWORD)'
42
43docker-push-registry: $(NAME)-force docker-tag-registry
44 docker push $(DOCKER_REGISTRY_USERNAME)/$(DOCKER_REGISTRY_NAME):$(DOCKER_REGISTRY_TAG)
45
46dist-clean-images:
47 docker image prune -a -f
48
49dist-clean-volumes:
50 docker volume prune -f
51
52dist-clean: clean-containers dist-clean-volumes dist-clean-images