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